Tuesday, June 15, 2010

Linux Hacks 1:Change present working directory for cd command using CDPATH

If you are frequently using cd command for browsing subdirectories of a specific parent directory, you can export settings to CDPATH variable and use cd command for all subdirectories without using full path of parent directory.
user@hostname|~#pwd /home/user
user@hostname|~# cd temp
bash: cd: temp: No such file or directory
#This is checking for temp directory under the current  directory....
user@hostname|~# export CDPATH=/media
user@hostname|~# cd temp
/media/temp
user@hostname|/media/temp# pwd
/media/temp

No comments:

Post a Comment