Linux Command –CD command

Source: Internet
Author: User

The CD command is another very important command in Linux, and this article introduces you to the use of CD commands in Linux.

For more information on Linux commands, see: Linux Command Quick check manual

The Linux CD command is used to switch the current working directory to dirName (directory parameters).

Where dirName notation can be either an absolute path or a relative path. If the directory name is omitted, it is transformed to the user's home directory (that is, the directory where login was first).

In addition, "~" is also indicated as the home directory meaning, "." is the current directory, "." Represents the current directory location of the previous level of the directory.

One, Linux CD command syntax
CD [DirName]

DirName: The target directory to switch to.

Ii. Examples of Linux CD commands

Jump into the test directory:

[Email protected]/root/linuxdaxue.com] #cd testdir/[[email Protected]/root/linuxdaxue.com/testdir] #lsfile1  File2  File3

Skip to top level directory

[Email Protected]/root/linuxdaxue.com/testdir] #cd. [Email protected]/root/linuxdaxue.com] #lstestDir

Skip to top level directory

[Email Protected]/root/linuxdaxue.com/testdir] #cd. /.. /[[email Protected]/root] #ls

Jump into user home directory

[Email Protected]/root/linuxdaxue.com/testdir] #lsfile1  file2  file3[[email protected]/root/ Linuxdaxue.com/testdir] #cd ~/[[email protected]/root] #pwd/root

Using absolute paths

[Email protected]/root] #cd/root/linuxdaxue.com/testdir[[email Protected]/root/linuxdaxue.com/testdir] #lsfile1  file2  File3

Working with environment variables

[Email protected]/root] #cd $TEST _path[[email protected]/root/linuxdaxue.com/testdir] #lsfile1  file2  file3

Jump in last used directory

[Email protected]/root] #pwd/root[[email protected]/root] #cd-/root/linuxdaxue.com/testdir[[email protected]/root/ linuxdaxue.com/testdir]#

CD command is relatively simple, mainly used to switch working directory, I hope you can master.

For more information on Linux commands, see: Linux Command Quick check manual

    • Copyright Notice: original article, 3 months ago, published by the University of Linux (linuxdaxue.com), a total of 1002 words.
    • reprint Please specify: Linux Command –CD Command | Linux University

Linux Command –CD command

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: info-contact@alibabacloud.com 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.