Linux Command Learning Path-Change Working directory: CD

Source: Internet
Author: User

usage rights: all roles

How to use:CD [TargetDir]

role: This command is used to switch the working directory in Linux

Note the point:

The 1.targetDir represents the target directory and can be represented by an absolute or relative path;

2. When TARGETDIR is omitted, it will switch to the user's home Directory (typically/root)

3. When TARGETDIR is "~", it will also switch to user's home Directory

4. "." Represents the current directory

5. ".." Represents the previous level of the current directory, or in the case of a continuous multi-tiered directory switch, the ".." Add "/" after

Examples of Use:

1. Use absolute path

(1) (assuming my current directory is/) enter/USR/ETC:CD/USR/ETC or CD usr/etc

(2) (assuming my current directory is/home) into/USR/ETC:CD/USR/ETC

(3) Enter home DIRECTORY:CD or CD ~; Note that home directory here does not refer to//, but refers to the default directory that the user enters

2. Using relative paths

(1) Go to sub-directory admin (assuming I am currently in the directory/usr/etc, there is folder admin under it)

CD Admin

(2) Enter the parent directory: CD.

(3) go to upper Parent directory: CD. /..

Summary: from the above can be learned that in absolute path access, the front must have "/" symbol, and the relative path to access subdirectories, do not have to add "/" symbol; When you select a path, you can quickly enter the form of the first few letters + TAB

Linux Command Learning Path-Change Working directory: CD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.