Common Linux commands-file processing command 1

Source: Internet
Author: User
We all know that Linux uses a graphical interface to perform operations, which does not meet all requirements. However, if we use commands, we can perform all the operations in Linux. So what is more important to learn about Linux is to learn how to use commands. in these commands, file processing commands are still the most basic...

 

We all know that Linux uses a graphical interface to perform operations, which does not meet all requirements. However, if we use commands, we can perform all the operations in Linux. So what is more important to learn about Linux is to learn how to use commands. in these commands, file processing commands are the most basic.

Before introducing the file processing commands, we will first introduce the file naming rules in Linux. in Linux, except for the slash (/), it cannot be used as a part of the file name, and others can be used as file names. Because the slash represents the Linux root directory. But we should avoid using it. | <> '$! %? * \ () And so on, because these have special meanings in Linux. Do not use "." as the start of the file name for normal files, because the default hidden files starting with "." in Linux. The last point is very important. in Linux, uppercase and lowercase are sensitive. we can think that the Linux core is written in C, and C is case sensitive, so Linux is also case sensitive.

The following describes the naming format: the command _-option _ parameter. the preceding "_" indicates a space. Here, if our command has multiple parameters, you can write them together, for example, ls-la/etc. If the command is correctly executed, a value of 0 is returned. Otherwise, a non-0 value is returned. There is also a regular rule that Linux generally uses abbreviations of some English words, usually the first and third letters.

Commands in Linux are generally divided into two types: one is a command that can be executed by the root user, and the other is a command executed by all users. Commands that can be executed by the root are generally stored in the/sbin or/usr/sbin directory, and all user commands are stored in the/bin or/usr/bin directory, therefore, we can use the directory where the command is located to know which type of command to execute.

Next we will introduce the first command ls, short for list. The Command directory is/bin/ls. Therefore, we can see that all users can execute commands. Here, we only need to remember the three parameters a, l, and d. when other parameters are used, we can query books. -A indicates displaying all files, including hidden files;-l indicates displaying details;-d indicates viewing directory properties.

The following is a command execution result:

This is the result obtained after we execute ls-l/. here I just cut a part of the root directory. we will be confused about the output and cannot understand it, I will introduce it in detail below.

At the beginning, there are 10 characters, and the first represents the file type. remember the following letters: d indicates the directory file when the file is located, and "-" indicates that the file is a common binary file, -l indicates that this file is a soft link file. We will introduce the link later. The following nine characters are divided into three groups, each with three groups. let's first introduce the meaning of these characters. r (read) indicates read permission, w (write) indicates the write permission, and x (execute) indicates the execution permission. In the first group, the three indicate the permissions of the owner. The owner here generally refers to the creator of the file, but sometimes the creator of the file may give the ownership of the file to another user, this user is also the owner of the file. The three in the second group indicate the permissions of the group to which the user belongs. each user has a group. The third represents the permissions of other users, except for the first two users.

Next is a number, which indicates the number of hard links. We will introduce it later.

Then there are two users. The first one is the owner of the file, and the second one is the owner group of the file.

Followed by a number, which indicates the size of the file, but this is not accurate, it does not represent the file in the file sub-directory.

The last time is the file creation time or the last modification time.

The last is the file name.

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.