To navigate using the terminal you will use 2 commands; cd
and ls
.
To change directory you use cd
. Ex: cd myfolder/anotherFolder
.
You can type pwd
to display the current directory you are in.
To list the content of a directory use ls
. You can get more info about the content of a directory using ls -al
.
You will notice that here are 2 directories which are always present wherever you list the content of a directory: .
and ..
.
.
is simply a reference to the current directory so typing cd ./somedir
and cd somedir
are equivalent.
..
is a reference to the parent directory. So using cd ..
will move you back to the parent directory.
There are 2 ways to navigate. Either by using the full path or by using the relative path.
Let's say you are in /Users/user20378
. If you want to get to /Applications you can either navigate there using the full path cd /Application
or the relative path cd ../../Applications
.
Depending on where you want to navigate the relative path can be more or less efficient than the full path.
Use tab while typing the name of a folder or a file to auto complete.