Linux Command-----CD

Source: Internet
Author: User
Tags switches

linux Command ----CD


"Feature description"

CD: Represents the Cut directory (change directory);


"Command Syntax"

CD [options] [parameters]


"Option description"

CD or cd~: Indicates whether the current directory can be switched to the user's home directory instantaneously

Cd.. : Indicates the switch from the current directory to the previous directory, note: There are spaces behind the CD in addition.

Cd.. /.. : The table switches from the current directory to the previous level of the previous directory,

CD-: Indicates the directory or directory where you switched to the last path you were in

CD!$: Indicates that the last command parameter was called


"Parameter description"

Parameters: Indicates the target path directory such as:/ETC/RC.D/INIT.D


Add: In order to avoid the wrong operation, we should check our current location PWD when deleting files and directories.


"Instance 1"

Switch back to the user's home directory from the current directory;

[Email protected] ~]# Cd/test/testfile/testfile2

[Email protected] testfile2]# CD Testfile3/testfile3_1/testfile3_2

[Email protected] testfile3_2]# pwd

/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2

[[Email protected] testfile3_2]# CD

[[email protected] ~]# switch directly back to the user home directory


"Instance 2"

Switch from the current directory to the previous level directory and switch to the top level of the previous directory

[Email protected] testfile3_2]# pwd

/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2

[Email protected] testfile3_2]# CD. represents a switch from the current directory testfile3_2 to Testfile3_1

[Email protected] testfile3_1]# CD. /.. represents a switch from the current directory testfile3_1 to Testfile2

[Email protected] testfile2]#


"Instance 3"

The directory that switches from the current directory back to the previous path, typically used when two directories are switched back and forth

[Email protected] ~]# Cd/test/testfile/testfile2

[[email protected] testfile2]# ls testfile2 with two directories testfile3 and Testfile4

Testfile3 testfile4

[Email protected] testfile2]# pwd

/test/testfile/testfile2 PWD Displays the current path

[Email protected] testfile2]# CD Testfile3/testfile3_1/testfile3_2

[Email protected] testfile3_2]# pwd

/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2

[[Email protected] testfile3_2]# CD- now required to testfile2 directory

/test/testfile/testfile2

[Email protected] testfile2]# CD Testfile4/testfile4_1

[Email protected] testfile4_1]# pwd

/test/testfile/testfile2/testfile4/testfile4_1

[Email protected] testfile4_1]#


Example 3 shows that "CD-" can help you when you're at work and you're going to switch back and forth between two directories, otherwise you'll have to enter a bunch of paths


CD command will always accompany us until the end, to be skilled, otherwise you will get lost.



This article is from the "Falcon" blog, please make sure to keep this source http://duying.blog.51cto.com/10484057/1674044

Linux Command-----CD

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.