4.6. Leaving your Current Working Directory

To change directories from your current working directory, use the command cd.

cd /tmp/

The above command changes directories to the /tmp/ directory. The second word on the command line must be a path. It can either be relative or absolute, and can move one directory or many. If the cd command is entered at the shell prompt with no options or path specified, the default action is to move the user into their home directory. For example, user someone would be moved to the /home/someone/ directory.

The cd has many useful options. You can see all of these options by entering man cd at the shell prompt. The most commonly used options are listed below.

Below are a few examples of the use of cd.

If you attempt to cd into a directory you do not have permission to access, you are denied permission to access that directory.

Denying access to the root and other users' accounts (or home directories) is one way your Red Hat Enterprise Linux system prevents accidental or malicious tampering. Refer to Section 4.11 Ownership and Permissions for more information.