While everyone familiar with a shell know about the command cd
there are a few tips you should know.
$ pwd
/tmp
$ cd
$ pwd
/home/solene
Using cd
without argument will change your current directory to
your $HOME.
While this should fail most of the time because people shouldn't allow
anyone to visit their $HOME, there are use case it can be used though.
$ cd ~user1
$ pwd
/home/user1
$ cd ~solene
$ pwd
/home/solene
Using ~user
as a parameter will move to that user $HOME directory,
note that cd
and cd ~youruser
have the same result.
This is a very useful command which allow going back and forth between
two directories.
$ pwd
/home/solene
$ cd /tmp
$ pwd
/tmp
$ cd -
/home/solene
$ pwd
/home/solene
When you use cd -
the command will move to the previous directory
in which you were. There are two special variables in your shell:
text/gemini
This content has been proxied by September (3851b).