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

Source: Internet
Author: User

The use of the Linux ls command Daquan

Learning Linux So long, the most common command is the LS command, today summed up the use of LS command and experience skills.

ls command to view files by file sizeA. Descending: Ls-lsh[email protected]:~$ ls-lshtotal 20M 20m-rw-r--r--1 moudaen 65536 20M Nov 17:44 gender.war4.0k DRWXR-XR -X 2 moudaen 65536 4.0K Nov 17:44 test8.0k-rw-r--r--1 moudaen 65536 5.2K Nov one 11:44 myapp.java command explanation: three parameters after LS:-L represents Long format display, which lists file details such as the format above. -S indicates a sort, and the default is descending order. -H is the size reference link that converts the file size to the m,k we are accustomed to, such as the unit:Linux ls command sorted by file size, Linux ls command parameter detailed: http://www.xfcodes.com/linuxcmd/all/32483.htm first, the ls command parameter detailedYou can get a complete list of options by reading the LS manual page (man ls). -a– (All). Lists all the files in the directory, including hidden files (. filename). Located at the beginning of this list: And. In turn, it refers to the parent directory and your current directory. -l– Length (long). Lists the details of the contents of the directory, including permissions (mode), owner, group, size, creation date, whether the file is a link to other parts of the system, and links to the link. The file type-f–. Add a symbol after each list of items. These symbols include:/indicate is a directory; @ indicates a symbolic link to another file; * indicates an executable file. -r– reverse (reverse). Lists the contents of the directory from the back to the front. -r– recursion (Recursive). This option recursively enumerates the contents of all directories (under the current directory). -s– size. Sort by file size. Example of use of LS command

For example: LS | Less is used to implement the paging of the file list, LS calculates the number of files in the current directory ls-|*|grep "^-" | WC-|  finally say some of the files in the Linux file color meaning   Green----> on behalf of the executable, (green represents the meaning of the pass) hehe   RED----> represent compressed files   dark blue----> Representative Directory   light blue-----> for linked files   Gray----> represents some other file  3. Common parameters:  -a,–all lists all files under the directory, including the. The implied file at the beginning-A with-a, but does not list "." (represents the current directory) and ".." (Represents the parent directory of the current directory). -C   Mate-lt: Sort and display CTime according to CTime (time of last change of file status) Mate-L: Show CTime but sort by name otherwise: Sort by CTime (-c) list items from top to bottom –color[=when] control whether color points are used Identification of documents. When can be ' never ', ' always ' or ' auto ' one of them-d,–directory displays the directory like a file, rather than displaying the file under it. -d,–dired produces the dired mode that is suitable for Emacs use results-f to the output file is not sorted, the-au option takes effect, the-LST option fails-g similar to-l, but does not list the owner-g,–no-group does not list any information about the group-h,–human- Readable lists the file size in an easy-to-understand format (for example, 1K 234M 2G) –si similar to-H, but the file size takes 1000 of the time instead of 1024-h,–dereference-command-line using the symbolic link in the command column to indicate the true destination – The Indicator-style= method specifies that each project name is followed by an indicator symbol < >:none (default), classify (-f), File-type (-p)-i,–inode prints the inode number for each file "Linux Description of LS command and use instance of LS command "the-i,–ignore= style does not print any items that conform to the shell Universal Character < STYLE >---–block-size=1k, which represents the size of the file in K-byte form. -L In addition to the file name, also the permissions, owner, textDetails such as the size of the pieces. -l,–dereference when displaying the file information of a symbolic link, the information indicated by the symbolic link is displayed instead of the symbolic link itself---all items are separated by commas, and fill the entire line of line width-o similar to-L, showing details of the file in addition to the group information. -r,–reverse in reverse order-r,–recursive All subdirectory tiers are listed  -s,–size the size of all files in block size-s sort 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 sorted by file modification time-u mate-lt: Display Access time and sort by access time mate-L: Show access time but sort by name otherwise: Sort by access time----------------------list items in the original order of the file system-V by version-w,–width=cols Specify the screen width without using the current value-X List items line by row instead of column-x sort by extension-1 lists only one file per line help displays this help information and leaves –version to display version information and leave

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

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.