This post was originally published on my blog, find original post here
We'll see about how we can navigate around the file system using bash commands.
First thing, we need to know is where we are in the file system.
We call that directory as current directory or working directory.
To find out the working directory, we can use
santhosh@ubuntu:~$ pwd /home/santhosh
Full form of
pwdis Print Working Directory .
Lot of bash commands are abbreviations. So it is easy to remember.
we can see the files and folders are under the current directory by using the
santhosh@ubuntu-18-04:~$ ls Dev Documents Downloads
lsis short for list.
We can also provide arguments to bash commands which makes it more powerfull.
to see the hidden files, use
santhosh@ubuntu-18-04:~$ ls -a Dev Documents Downloads .bash_history
Refer the manual of
lsfor more arguments
We can move around the system using
santhosh@ubuntu-18-04:~$ cd Documents santhosh@ubuntu-18-04:~/Documents$ _
To move to parent directory
santhosh@ubuntu-18-04:~/Documents$ cd .. santhosh@ubuntu-18-04:~$ _
..(double dot) is reference to the parent directory.
.(single dot) is reference to the current directory.
~is reference to the home directory.
/is reference to the root directory.
if we run
cd command without any argument, we will move to the home directory irrespective of working directory.
Command line can autocomplete our command and paths with
tabkey. You can try it yourself.
(open source and trusted by devs everywhere ❤️)