CDPATH
Use CDPATH to define the base directory for command
$export CDPATH=~:/etc:/proc $cd systemd $pwd /etc/systemd
From the book “Linux 101 Hackers”, Ramesh Natarajan.
MKDIR and CD in one shot
Add this function to your bash_profile
$vim .bash_profile function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }
From the book “Linux 101 Hackers”, Ramesh Natarajan.
Toggle between the last two directories
$cd -
will bring you to the previous path you were. If you use it again, you are back in path you were the first.
From the book “Linux 101 Hackers”, Ramesh Natarajan.
Using the directory stack
You can use the directory stack to store directory paths, display and cd to it.
- dirs: Display the directory stack
- pushd: Push directory into the stack
- popd: Pop directory fom the stack and cd to it
From the book “Linux 101 Hackers”, Ramesh Natarajan.
For more examples visit the blog of the geekstuff