One day a linux Base command Directory Management Class command CD

Source: Internet
Author: User
Tags parent directory

CD Switch Directory command

1. command format

CD [option] [ directory name ]

2. Command function

Switch working directory

3. Common examples

Example 1:CD ~

Description:~ default is the home directory of the root, if the ~ after the user name, you can enter the home directory of the specified user

[Email protected] ~]#

[[Email protected] ~]# CD/

[Email protected]/]# pwd

/

Description: Enter the system root directory , after the above command to take the pwd command to see, the current directory has been to the system root directory .

[Email protected]/]# CD ~

[Email protected] ~]# pwd

/root

Description: Use CD Command Implementation Entry Root the user's home directory.

[Email protected] ~]# CD ~STU1

[Email protected] stu1]# pwd

/home/stu1

Description: Use CD command implementation into the ordinary user STU1 home directory.

Example 2: Jump to the specified directory cd/var/log

[Email protected] stu1]# cd/var/log/

[Email protected] log]# pwd

/var/log

[[email protected] log]# ls

[Email protected] log]# CD httpd

[Email protected] httpd]# pwd

/var/log/httpd

[Email protected] httpd]#

Description : Jump to the specified directory, starting at the root directory, and adding the directory name / , the subdirectory in the current directory can write the name directly; relative path: The path starting at the current position  

Example 3 : CD- : Returns the directory where it was before entering this directory

[Email protected] httpd]# cd/usr/share/yum-

[Email protected] httpd]# cd/usr/share/yum-plugins/

[Email protected] yum-plugins]# CD-

/var/log/httpd

[Email protected] httpd]# CD-

/usr/share/yum-plugins

[Email protected] yum-plugins]#

Example 4: use cd!$ The parameters of the previous command as CD parameters

[Email protected] ~]# ls/var/log/

Anaconda.ifcfg.log btmp DMESG maillog-20161129 PPP Spice-vdagent.log

[Email protected] ~]# CD!$

cd/var/log/

[Email protected] log]# pwd

/var/log

[Email protected] log]#

Example 5: Return to the parent directory CD of the current directory .

[Email protected] log]# pwd

/var/log

[Email protected] log]# CD.

[Email protected] var]# pwd

/var

[Email protected] var]#


This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1879771

One day a linux Base command Directory Management Class command CD

Related Article

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.