Monday, 5 December 2011

Powerful of Linux CD Command for Admins,Devlopers,Testers,Supporters


Powerful of Linux CD Command for Admins,Devlopers,Testers,Supporters


CD is one of the most frequently used command during a UNIX and LINUX session. I am going to add some useful practical examples of CD command. This will increase your productivity and make it easier to navigate the directory from CLI.

CDPATH: If you are performing CD to sub directories  of a any specific parent directory and you can set the CDPATH variable to the parent directory and perform CD to to the sub directories without Giving parent directory path.

Example:




To make this change permanent, add export CDPATH=/etc to your
~/.bash_profile

export CDPATH=.:~:/var:/usr:/etc

Directory stack

dirs: Display the directory stack
pushd: Push directory into the stack
popd: Pop directory from the stack and cd to that directory




Automatically Correct Mistyped Directory Names using shopt -s

Use shopt -s cdspell to correct the typos in the cd command
automatically as shown below




No comments:

Post a Comment