
Bash Directory Triviaįun Fact: calling cd without any arguments is the same as calling cd ~. Either command would navigate into the directory named down within the current working directory.

Otherwise it is used as a directory separator: dir/subdir When alone or at the beginning of a file path, this is the root directory. Remember that a few symbols have a specific meaning in the filesystem: Symbol Moves to the PDFs directory within the Downloads directory within the home directory.
WHAT IS GIT BASH A FLAG CODE
Moves to the code directory within the Admin directory within the Users directory within the root directory. Moves into the sub2 directory within the sub1 directory within the current working directory. Moves up two levels, to the parent directory of the parent directory. Moves down into the subdirectory named dirname. You can easily move up and down to a parent or child directory in Bash using the cd command: Command This lists the contents of the otra directory instead of the current working directory.Ī combination of everything above, resulting in a long listing of all contents of the otra directory. Without the - in front of it, otra is an argument and not a switch.
WHAT IS GIT BASH A FLAG HOW TO
This is how to call the ls command with both the -a and -l switches, resulting in a long listing of all directory contents. The -a switch lists all directory contents, including those starting with a period(.) which Bash considers hidden. The -l switch gives a long listing of directory contents, including date, permissions, etc. First comes the command itself, then any switches/flags for how the command should behave, then any specific arguments - the items the command will operate upon. Command: lsīash commands have a certain format to them. In fact, dir still works in Bash! The output isn't formatted as nicely as the ls command, though.
WHAT IS GIT BASH A FLAG WINDOWS
If you are used to Windows Command Prompt, you will notice this is very similar to the dir (directory) command in the Command Prompt. This will simply list the items in the current working directory. You can use the ls command (list) to list all items inside the directory: ls Directories can have files and other directories inside them. Your current working directory is, of course, a directory. You should now see ~ as your current working directory. This will take you to your home directory. Just pass it the name of a directory, and it will change the current working directory: cd ~ You can navigate to any directory with the cd command (change directory). See how the / at the end means Bash is currently working in the root directory? The Bash prompt shows the current working directory (CWD): MINGW64 / In Windows this is C:/Users/YourUsername. This is the directory where your user account files are stored. In Windows, this is the same as the C:/ drive. In Bash, there are two special directories: You can use Bash to create, rename, move, and delete files and directories. The first step to using Bash is knowing how to navigate through your computer's filesystem. These files and directories are called the filesystem. Those files are organized into directories (on Windows, directories are often also called folders). Your prompt will look slightly different because it will display your own details.

As you read about the different commands that Bash offers, try them on your own machine and start getting comfortable with them. We just type a few words and watch the magic happen.īash is not an optional technology.

Often, this speeds up the process because we don't need to open a new program, click around, type something in, click around some more, and then close the program, all for a single task. Using Bash, we can perform many actions on our computers using just text commands. The Git Bash program allows Windows users to use Bash as well. They can use Bash one command at a time, or they can write a script file with many commands in it.Ĭomputers running Linux and OS X already come with the ability to use Bash. Programmers type specific words or abbreviations to execute commands. Git Bash is already installed on your We Can Code IT machine. It allows Windows users to use the Bash command language and more easily work with the Git version control system.īash and Git are separate technologies, but Git Bash is a single program that makes it easy to use both of them on Windows. Git Bash is an application for the Windows operating system.
