Navigating the Linux filesystem is very easy. The cd command is used to move to another directory. But there are other ways too.
To navigate back to the last directory you were in, type cd -
. This will take you back to where you were before.
ubuntu /usr/share $ cd - /home/ubuntu |
The cd ~
command will take you back to your home directory.
The user can also use the cd
command by itself to go back to the home directory.
ubuntu /usr/share/debhelper $ cd ubuntu ~ $ |
Using cd ..
will take you back one directory.
ubuntu ~ $ cd .. ubuntu /home $ |
To navigate to another directory, use this command.
jason@jason-desktop:~$ pushd Documents/ ~/Documents ~ |
This is a good alternative to using cd all of the time. Using pushd shows the directory you navigated to, as well as the one you just left.
jason@jason-desktop:/usr/share/vte$ pushd ~/Documents/ ~/Documents /usr/share/vte ~ |
When editing a command line in bash, use Ctrl-a to go to the start of the command and Ctrl-e to go to the end. Unless you are using mate-terminal. Then you may use home and end instead.
Here is yet another way to change directory.
ubuntu ~ $ PWD=$PWD/usr/share ubuntu ~/usr/share $ |
This is an alternative to the cd command.