cd (change directory) is a command used to switch directories/ folders from the terminal’s shell. You can press the tab button in order to auto complete the directory name.
Syntax
$ cd [directory]
Examples of CD command in Linux/Unix
ChangeĀ to home directory (determined by $HOME environment variable):
[[email protected]]# cd
Change to home directory:
[[email protected]]# cd ~
Show last working directory from where we moved from:
[[email protected]]# cd --
Change to root directory:
[[email protected]]# cd /
Change to parent directory:
[[email protected]]# cd ..
Move three directories up from where you are now:
[[email protected]]# cd ../ ../ ../
Change to subdirectory Documents and list all files:
[[email protected]]# cd Documents && ls -la
Change to subdirectory Documents/Projects:
[[email protected]]# cd Documents/Projects
If you wish to change to a directory with absolute path /home/user/Desktop:
[[email protected]]# cd /home/user/Desktop
Change to directory name with white space – Where Are My Images:
[[email protected]]# cd Where\ Are\ My\ Images
or
[[email protected]]# cd "Where Are My Images"
or you can try
[[email protected]]# cd 'Where Are My Images'
Change from current working directory to /usr/local/src without typing in full using TAB:
[[email protected]]# cd /u<TAB>/l<TAB>/s<TAB>
Recent Comments