Linux Small white-basic command-CD

Source: Internet
Author: User


CD

"function description":Linux CD commands can be said to beLinuxThe most basic command statements, and other command statements to be manipulated, are created using theCDon the command. So, learnLinuxthe Common command, first of all, must learnCDtips on how to use commands. its function is to switch the current directory toDirname (directory name).

"Syntax format": CD [ directory name ]


"Practice Actions":

Example one: Enter the system root directory

Command:

CD/

Output:

[[Email protected] ~]# CD/

Description: Enter the system root directory , after the above command is executed, take ls command to see that the current directory is already in the system root directory

Command:

CD: Or CD..//

Output :


/opt/soft
[[email  protected] soft]# cd ..
[[email  PROTECTED] OPT]# CD&NBSP, ....

Span style= "font-family: ' The song body '; font-size:16px;" >/ 

Description

Enter the system root directory to use the CD. " always back, you can reach the root directory

Command:

Cd.. /.. //


/opt/soft
[[email  PROTECTED] SOFT]# CD&NBSP, .... /..  //

Span style= "font-family: ' The song body '; font-size:16px;" >/

Description: using the CD The command implements the parent directory into the parent directory of the current directory.  

Example 2 : Using CD command to enter the current user home directory. The "Current User home Directory" and "system root" are two different concepts. There are two methods to enter the current user home directory.

Command 1:

Cd

Output:

[Email protected] soft]# pwd
/opt/soft
[[Email protected] soft]# CD
[Email protected] ~]# pwd
/root

Command 2 :

CD ~

Output:


[[email  protected] soft]# pwd
/opt/soft
[[email protected] soft]# cd ~

/root

Example 3 : Jump to the specified directory

Command:

Cd/opt/soft

Output:

[email protected] ~]# Cd/opt/soft
[email protected] soft]# pwd
/opt/soft
[email protected] soft]# CD jdk1.6.0_16/
[email protected] jdk1.6.0_16]# pwd
/opt/soft/jdk1.6.0_16
[email protected] jdk1.6.0_16]#

Description

jumps to the specified directory, starting at the root directory, with the directory name added / , the subdirectories in the current directory can be written directly by name

Example four: Return to the directory in which it was before entering this directory

Command:

CD-

Output:

[email protected] soft]# pwd
/opt/soft
[email protected] soft]# CD-
/root
[email protected] ~]# pwd
/root
[[email protected] ~]# CD-
/opt/soft
[email protected] soft]#


Example Five: Use the parameters of the previous command as CD parameters.  

Command:

CD!$

Output:


cd -
/root
[[email  protected] ~]# cd !$
Span style= "font-family: ' The song body '; font-size:16px;" >cd -
/opt/soft
[[email protected] soft]# 


This article is from the "Cornerboy" blog, make sure to keep this source http://cornerboy.blog.51cto.com/10012663/1651567

Linux Small white-basic command-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: 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.