everything and nothing

allskonar

For a bash novice like me it’s often hard to argue why working in the terminal is superior than not working in the terminal. Then I find something like THIS a page that explains ways to quickly jump around directories in the terminal by using CDPATH, pushd and popd. Even with tab completion navigating up and down directories with cd can become very tiresome and those three commands can alleviate that pain. The page explains it better than I will be able to but here is the gist of things.

CDPATH By setting your CDPATH to for example

export CDPATH=/home/{user}/sites:/home/{user}/documents

it will allow you do simple do

cd foo

and it will drill down into directory by the name of foo in the ~/sites folder.

This will take over a directory by that name in locations defined after ~/sites in CDPATH and even if you are trying to go into foo in the current directory

pushd If you are in a directory and you know you will be going there again soon you can put it into a dirs stack with the command pushd . and then you go to another dir and by doing popd it will throw you back to the dir that is first in the dirs stack.

As I mention before it is sometimes hard to explain how the terminal can be a better place to do your work so trying it out is the best way to get more and more comfortable with it.

Leave a Reply

 
allskonar Powered by Mephisto