Use the ls command in CentOS to view and analyze linux File Attributes

Source: Internet
Author: User

Use the ls command in CentOS to view and analyze linux File Attributes

Linux File Attributes play an important role in file system security management. There are eight file attributes in Linux, which can be viewed by using the ls command. You can selectls -alhAdding a will show hidden files orls -ilhOrllCan be viewed.

The first column is the index node number, which is understood as the directory of a book. The number of the basic attributes of the file is stored here.

Column 2: File Permission, with a total of 10 Characters

Linux Files are basically divided into three attributes: readable (r), writable (w), and executable (x ). Ten grids can be added here (10 bits are actually implemented in a specific program ).

  • If it is [d], it is the object name, for example, the line named phpconf.
  • If it is [-], it is an archive, for example, the row with the file name vhost. sh.
  • If it is [l], it indicates a link file (lin k file)
  • If it is [B], it is the interface device (random access device) that can be stored in the device file)
  • If it is [c], it indicates the serial port device in the device file, such as the keyboard and mouse (one-time reading device)

The remaining grids are in the unit of 3. Because Linux is a multi-user multi-task system, a file may be used by many people at the same time, so we must set the permissions for each file,

The permission positions of the files are arranged in the following order (take-rwxr-xr-x as an example): rwx (Owner) r-x (Group) r-x (Other)

In this example, the permission is:

  • The owner is readable, writable, and executable;
  • Users in the same group are readable, non-writable, and executable;
  • Other users are readable, not writable, and executable.

In addition, the execution of some program properties is not x, but s, which indicates that the user who executes the program can temporarily execute the program with the same power as the owner. Generally, commands or programs such as System Management enable the user to have the root identity during execution.

Column 3: indicates the number of files, that is, the number of hard links. If it is a file, the number is naturally 1. If it is a directory, the number is the number of files in the directory.

Column 4: indicates the owner of the file or directory. If the user is currently in his/her home, this column is probably the name of his/her account.

Column 5: group ). Each user can have more than one group, but most users should belong to only one group. Only when the system administrator wants to grant special permissions to a user, to another group.

Column 6: file size. The file size is represented by byte by default, while the empty directory is usually 1024 bytes. Of course, you can use other parameters to make the file display unit different, for example, if ls-k is used, the size unit of a file is displayed in kb. However, we generally use byte as the main unit.

Column 7: indicates the creation date. In the format of "month, day, and time", for example, Aug 15 indicates on January 1, August 15.

Column 8: name of the file or directory.

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.