How to change a working directory


Change Directory - change the current working directory to a specific Folder.

The syntax is cd followed by the name of the directory you want to go to.

For example:

cd /home/user/public_html  to change the current working directory  to /home/user/public_html.

The '/' indicates the path relative to the root directory, and no matter what directory you are in when you execute this command, the directory will be changed to /home/user/public_html.

cd public_html/ to change the current working directory to public_html/, relative to the current location which is /home/user. The full path of the new working directory is /home/user/public_html.

cd ..                                        Move to the parent directory of the current directory. This command

                                              will make the current working directory "/home.

cd ~                                        Move to the user's home directory which is "/home/username".

                                              The '~' indicates the users home directory.

48134 times

Need help? We're always here for you.