Saturday, 28 January 2012



cd command helps you to move around directories. various options of cd helps you
in navigating between your current directory to previous working  directory, or one directory
behind and so on..

cd   in unix provides much more options than the cd in DOS. you will see in these examples.

1)      You  are working in a directory other than your home and want  to go to your home directory($HOME), just enter cd.

/home/dimuser/functions/standard/cpp$ echo $HOME

/home/dimuser/functions/standard/cpp$ cd
/home/b768 $
‘cd ‘ is same as ‘cd $HOME’

2)      You need to go to your last working directory.

/home/b768$ cd /var/utilities

/var/utilities$ cd  -
/home/b768           #here it echoes the directory into which you are moving
/home/b768 $cd –

3)      To move  one directory behind use ‘ ..’ ,ie two dots
/home/b768$ cd  ..

Note that ‘.’ Refers to the current directory and ‘..’ refers to a directory behind

4) To interchange similar directory structures as your current working directory.
     /home/b768/test/ALG/bin $cd  test  prod

Ensure here that the destination directory structure exists.
You can also simply change any particular string or a number in a directory name to a new one
and  move to the new directory path if it exists.
ie :-
    /home/b768/prod/ALG/bin$cd  68  54


No comments:

Post a Comment