Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Index | Next >
Learning objective: (3) Demonstrate the use of the cd command
cd command to change directory
The "cd" command allows you to navigate down or up the hierarchy tree. You can move up/down one level at a time or many by providing the appropriate path. If a path begins with a "/" forward slash, the reference is the root as an absolute path. If the path does not start with a "/" forward slash, the reference is based on the current working directory as a relative path.
cd or cd ~ (home directory)
The "cd" command by itself or the "cd ~" will take you to your home directory. In this example, the last "cd" command takes you back to the home directory. You can see the results from the "ls" command.
cd path
The "cd path/path" takes you down a path or series of path in the hierarchy tree. In this example the command "cd my-document/" takes you down one level to the my-documents directory. You can see the results from the "ls" command.
cd .. (parent)
The "cd .." takes you up a path or series of path in the hierarchy tree by using "cd ../..".
cd / (root)
The "cd /" takes you to the root of the hierarchy tree. In this example the command "cd /" takes you to the root of the operating system. You can see the results from the "ls" command.
DOS: CD
The equivalent in DOS would be "CD" and works mostly the same with the exception of the "\" backslash path separator or root reference.
Thinking: How many directories are there between your home directory and the root?
Key terms: child, directory, parent, path, root
Resources:
To maximize your learning, please visit these Web sites and review their content
to help reinforce the concepts presented in this section.
Quick links:
The cd Command
cd(1) - Linux man page
cd Command @ Wikipedia
Notes on navigation: Click inside the frame to navigate the embedded Web page. - Click outside the frame to navigate this page to scroll up/down between the embedded Web pages. - Click on the frame title to open that page in a new tab in most browsers. - Click on the the "Reload page" link to reload the original page for that frame.
The cd Command |
Reload page
|
If frame is empty, click on the link to view the page in a new tab or window
cd(1) - Linux man page |
Reload page
|
If frame is empty, click on the link to view the page in a new tab or window
cd Command @ Wikipedia |
Reload page
|
If frame is empty, click on the link to view the page in a new tab or window
Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Index | Next >