make CLI Comfortable When Working in Multiple Directoies

alias

alias is command-line counterpart of hotstring of AutoHotkey, for example:

alias vboat='vi ~/docs/erlang/boat.erl'

alias toerl='cd ~/docs/erlang'

If hope for later use, save them in ~/.bash_aliases(if it's spacified in .bashrc), otherwise, ~/.bashrc.

CDPATH

$CDPATH to command "cd" is the same with $PATH with executables, or $CLASSPATH to command "java". For example:

bvt@pwm:~/docs/test/workspace$ CDPATH=/usr/share/ant 
bvt@pwm:~/docs/test/workspace$ cd lib 
/usr/share/ant/lib 
bvt@pwm:/usr/share/ant/lib$

Save the value of CDPATH in .bashrc for later use.

Bookmarks of vim NerdTree

See note " Notes about NERDTree ";

Temporary directories switching

pushd <dir_name>: add to path stack and switch to it. For example pushd . add current path to path stack;

Switch between two directories

pushd: swap top and second item in stack and switch to second path;

cd -: "-" is $OLDPWD;

Switch between multiple directories

pushd +n or pushd -n (n is a 1,2,...): rotates the stack and change to the n-th path in stack, n is decided by dirs -v command;

dirs & popd

dirs -v: print the path stack;

See Linux / Unix Command: pushd.

原文地址:https://www.cnblogs.com/darkmatter/p/3606781.html