List Files Using Linux commands

Source: Internet
Author: User
Tags printable characters

LsList segment is a frequently used command in Linux.

Command Format:Ls args dir

Args: Parameter;

Dir: Directory. If it is omitted, it indicates the current directory;


Common Parameters and descriptions are as follows::

-A [common] lists all files in a directory, including hidden files starting.

-C: the time when the I node of the output file is modified and sorted accordingly.

-I: index information of the I node of the output file.

-K indicates the file size in the form of k bytes.

-L [common] lists detailed information about objects.

-M horizontal output file name, with "," as a grid character.

-N is replaced by the UID and GID of the number.

-O displays the details of the file except the group information.

-F attaches a character to each file name to indicate the file type: "*": executable normal file; "/": Directory; "@": Symbolic Link; "|": FIFOs; "=": socket (sockets ).

-Q used? Replace non-printable characters.

-R sorts directories in reverse order.

-S outputs the file size after each file name.

-T is sorted by time and recently modified to the top.

-U is sorted by the time when the file was last accessed.

-X is output by column and sorted horizontally.

-R recursion outputs the content of all subdirectories.

-S [commonly used] is sorted by file size, where large files are located.

-X is sorted by file extension (the character after the last ).

-1 (number 1): one row outputs only one file.

 

-- Color: display the color file name (equivalent to -- color = auto ).

-- Color = no: Do not display color file names

-- Time-style custom display time format (commonly used '+ % Y/% m/% d % H: % M: % s' format)

-- Help displays help information on the standard output.

-- Version outputs the version information on the standard output and exits.

 

TIPS:

Edit the/etc/bashrc file and add the code: alias ls = "ls -- color"

Make the color display always exist. The color meaning is as follows:

Blue [Directory]; green [executable files]; red [compressed files]; light blue [linked files]; gray [other files];

 

Custom display time format

$> Ls-l -- time-style '+ % Y/% m/% d % H: % M: % s'

Total 0

-Rw-r -- 1 root 0 2008/08/01 12:23:06 file1

-Rw-r -- 1 root 0 2008/08/01 12:23:06 file2

 

The system that supports -- time-style can be set with the environment variable TIME_STYLE;

$> Export TIME_STYLE = '+ % Y/% m/% d % H: % M: % s'

To take effect permanently, append the above sentence to/etc/profile.

 

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.