Linux ls command tutorial, how to use the ls command, all the tricks teach you, linuxls

Source: Internet
Author: User
Tags sorted by name

Linux ls command tutorial, how to use the ls command, all the tricks teach you, linuxls

Linux ls command usage

After learning linux for so long, the most common commands are ls commands. Today I will summarize the usage and experience of ls commands.

  Ls command to view files by file sizeA. descending order: ls-lshmoudaen @ morton :~ $ Ls-lshtotal 20 M 20 M-rw-r -- 1 moudaen 65536 20 M Nov 11 :44 Gender. war4.0K drwxr-xr-x 2 moudaen 65536 4.0 K Nov 11 test8.0K-rw-r -- 1 moudaen 65536 5.2 K Nov 11 MyApp. java command explanation: three parameters after ls:-l indicates to display in long format, that is, to list the file details in the preceding format. -S indicates sorting, Which is sorted in descending order by default. -H to convert the file size to the M, K, etc. as the unit of the size reference link: linux ls command by file size sorting, linux ls command parameters details: http://www.xfcodes.com/linuxcmd/all/32483.htm 1. ls Command ParametersYou can read the ls manual page (man ls) to obtain a complete list of options. -A-all (all ). List all files in the directory, including hidden files (. filename ). The... And. At the beginning of the List refer to the parent directory and your current directory. -L-long ). List the details of the Directory, including permissions (mode), owner, group, size, creation date, whether the file is linked to other places of the system, and the link pointing. -F-File type ). Add a symbol after each list item. These symbols include:/indicates a directory; @ indicates a symbolic link to other files; * indicates an executable file. -R-reverse (reverse ). List contents in the directory from the back to the front. -R-recursion ). This option recursively lists the contents of all directories (under the current directory. -S-size ). Sort by file size. Ls command instance

For example, ls | less is used to implement paging of the file list, ls calculates the number of files in the current directory. ls-| * | grep "^-" | wc-| Finally, the color of some files in linux is green. ----> indicates executable. file, (Green indicates the meaning of the Pass.) Haha red ----> indicates the compressed file dark blue ----> represents the directory light blue -----> represents the link file gray ----> represents some other files 3. common parameters:-a and-all list all files in the directory, including. the implicit file-A starts with-a, but does not list ". "(indicating the current directory) and" .. "(the parent directory of the current directory ). -C combination-lt: ctime-based sorting and ctime-based display (time when the last file state is changed) combination-l: ctime is displayed, but ctime is sorted by name otherwise: sort by ctime-C list items from top to bottom in each column-color [= WHEN] to control whether to use color resolution files. WHEN can be either 'never ', 'Always', or 'auto'-d.-directory displays the directory like a file instead of the file under it. -D and-dired generate results suitable for the dired mode of Emacs-f does not sort the output files, the-aU option takes effect, and the-lst option is invalid-g is similar to-l, but do not list owner-G,-no-group does not list any information about the group-h, -human-readable: list the file size in an easy-to-understand format (for example, 1 K 234 M 2G).-si is similar to-h, but the file size is equal to the power of 1000 instead of 1024-H, -dereference-command-line: Use the symbolic link in the command column to indicate the real destination-indicator-style = to specify that an indicator is added after each project name <method>: none (default ), classify (-F), file-type (-p)-I,-inode prints the inode number of each file. [linux ls command parameter description and ls command usage example]-I, -ignore = the style does not print any matching she The project-k of ll character <style> is-block-size = 1 K, and the file size is expressed in k bytes. -L in addition to the file name, the File Permission, owner, file size, and other information are listed in detail. -L,-dereference: when the file information of the symbolic link is displayed, the objects indicated by the symbolic link are displayed instead of the information of the symbolic link itself.-m all items are separated by commas, and fill in the whole row width-o similar to-l, display the detailed information of the file except the group information. -R,-reverse in reverse order-R,-recursive lists all sub-directory layers-s at the same time, -size: lists the sizes of all files in block size.-S is sorted by file size.-sort = WORD: The following are optional WORD and the corresponding options they represent: extension-X status-cnone-U time-tsize-S atime-utime-t access-uversion-v use-u-t sort by file modification time-u with-lt: show access time and sort by access time in combination with-l: show access time but sort by name otherwise: sort by access time-U is not sorted; list items in the original order of the file system-v sort items by version-w, -width = COLS: Specify the screen width by yourself without using the current value-x to list items row by row rather than column by column-X to sort by extension-1 to list only one file per line-help to display this help information and exit-version display version information and exit

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.