Daily linux Command _ls command

Source: Internet
Author: User

The LS command is the most commonly used command for Linux systems, and its function is to list the file directory information. This command is simple to apply, but with many parameters, share the main parameters and usage of the command below.


Parameters related to ls command:

Enter LS--help at the prompt, and the screen will display the command's format and parameter information:

First introduce the main parameters of the LS command:

-A lists all files under the directory, including the. The implied file at the beginning.

-a displays except for "." and ".." All files outside the

-B lists characters that are not output in the file name in the form of a backslash and character number .

-B does not output backup files ending with "~".

-C The modified time of the I node of the output file and sorted by this.

-C output By column, sorted vertically.

-D Displays the directory as if it were a file, rather than displaying the file below it.

-e The LS command option outputs the full information of the time, not the output of the brief information.

-f-u the LS command option can not sort the output files.

-I the LS command option to output the index information of the I node of the file.

-k the LS command option can represent the size of a file in the form of a byte.

-l The LS command option to list the file details.

-m The LS command option can output the file name horizontally and "," as a separator.

-N the LS command option can replace the name with the GUID of the number.

-o the LS command option displays the details of the file in addition to the group information.

-p-f the LS command option can include a character after each file name to indicate the type of the file, "*" for the executable plain file; "/" for the Directory; "@" for the symbolic link; "|" Represents FIFOs; "=" represents a socket (sockets).

-Q The LS command option can be used instead of characters that cannot be exported.

-r the LS command option can reverse-sort the directory.

-s The LS command option can output the file size after each file name.

-t the LS command option can be sorted in time.

-u the LS command option can be sorted by the time the file was last accessed.

-X the LS command option can be output by column and sorted horizontally.

-g The LS command option can output the information for a group of files.

-l The LS command option lists the link file names instead of the files that are linked to.

-N the LS command option will not limit file length.

-Q The LS command option can enclose the file name of the output in double quotation marks.

-r the LS command option can list files in all subdirectories.

-s The LS command option can be sorted by file size.

-X the LS command option can be sorted by the file's extension (the last character after the.).

1 The LS command option can output only one file on a single line.


The functions and parameters of LS command are used:

# ls-a----Show all files, including hidden files. where the. Start file is an implied file and cannot be seen directly with the LS command



# ls-al----A parameter is used in conjunction with the L parameter to display all directories and file details in a long list. Includes file type, file permissions, hard connections, file owner, file group, file size, change time, file name, and so on.

The 1th column: the type and permissions of the Drwxr-xr-x representative file

Start with D as a folder, start with a file,

The connection file begins with L

2nd Column: The number of links to the file.

3rd, 4 columns: Users and Groups with files

5th column: The size of the file.

6th column: The last modification time of the file.

7th column: File name


# Ls-al |more When there are too many files and directories under the folder, a screen display can be combined with pipe character and more command to achieve split screen display


# LS-LH h parameter combined with L parameter, more reasonable to display the size of the file.



# ls-d * * Only directory information is listed, not files displayed. Sometimes there are too many files and directories under the folder, you can display only the directory with the-d parameter



#ls-r file and directory information in directory and multilevel subdirectories



# LS-IL Displays inode information in the first column, which is the file index information



#ls-lt sorted by modified time, positive sequence display

#ls-ltr sorted by modified time, reversed-order display





Daily linux Command _ls command

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.