Self-study linux shell3.2-switch directory command CD

Source: Internet
Author: User
Tags parent directory

Click Back to learn the path of the Linux command line and shell script

3.1-Switch directory command man

When you log in to the system and get a shell command prompt, you are usually in your own home directory.

Verify with the PWD command:

The pwd command Displays the user's current working directory as an absolute path. command to write the full path name of the current directory (from the root directory) to standard output. All directories are / separated by use.
The first / represents the root directory, and the last directory is the current directory. The PWD command immediately learns the absolute path name of the working directory where you are currently located.

The CD command is used to switch the working directory to DirName. 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, ~ it is also indicated as home directory
       .Is the directory that is currently located
       ..Represents the previous level of directory at the current directory location.

Grammar
CD (options) (parameters)
Options
-P If the destination directory that you want to switch to is a symbolic connection, switch directly to the destination directory where the symbolic connection is directed to-L if the destination directory that you want to switch to is a symbolic connection, switch directly to the directory that the character connection name represents, not the destination directory that the symbolic connection points to. -When only the "-" option is applied, the current working directory is switched to the directory represented by the environment variable "OLDPWD".
Instance
    the CD enters the user's home directory, CD ~  enters the user's home directory, CD-  returns the directory where the directory was before it entered; CD.  Return to the parent directory (if the current directory is "/", then "/"; "..." after execution) For the meaning of the parent directory); CD. /..  Return to the top level two directory; CD!$  Use the parameters of the previous command as CD parameters.

Self-study linux shell3.2-switch directory 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.