Introduce some basic concepts about Linux Catalogs

Source: Internet
Author: User
Keywords Working directory home directory about can basic concepts
Tags basic basic concepts cat catalog class directory file files

A directory is a special file of Linux system organization files. To enable users to better use the catalog, we introduce some basic concepts about the catalog.

Working directory and user home directory

Logically, users are in a directory every moment after they log on to the Linux system, which is called the working directory or the current directory (sharable directory). The working directory can be changed at any time. When a user initially logs on to the system, its home directory becomes its working directory. Working directory with "." Indicates that its parent directory uses the "..." Said。

User home directory is http://www.aliyun.com/zixun/aggregation/13879.html "> system administrator to increase the user created (can also change later), each user has its own home directory, the different user's home directory is generally not the same.

When a user has just logged on to the system, its working directory is the user's home directory, usually the same as the user's login name.

Users can refer to their home directory by a ~ character.

such as command


/home/wang$ Cat ~/class/software_1

and the following command

/home/wang$ Cat/home/wang/class/software_1

meaning the same. The shell replaces the ~ character with the user's home directory name. Once the directory hierarchy is created, the user can put the relevant files into the appropriate directory to implement the organization of the file.

Path

As the name suggests, a path refers to a path from a directory hierarchy in a tree directory to a file. The main composition of this path is the directory name, separated by "/" in the middle. The location of any file in the file system is determined by the appropriate path.

When a user accesses a file, the path to the file is given. The path is divided into relative and absolute paths. An absolute path is a path that starts at the root, also known as a full path, and a relative path that starts at the user's working directory.

It should be noted that there is only one absolute path and relative path to a certain file in the tree directory structure. The absolute path is invariant, and the relative path changes as the user's working directory changes. This is good for us to use certain commands such as CP and Tar later.

When a user wants to access a file, it can be referenced by the path name, and it can be referenced based on the relative location of the file to be accessed and the user's working directory, without having to list the full pathname of the file. For example, user Wang has a directory named class with two files in it: Software_1 and Hardware_1. If user Wang wants to display a file named Software_1 in his class directory, you can use the following command:

/home/wang$ Cat/home/wang/class/software_1

The user can also reference the file Software_1 relative to the current working directory. The command is:

/home/wang$ Cat Class/software_1

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.