"Small Command Big effect" the third LS command-view directory or file

Source: Internet
Author: User

ls Command View a directory or file

Syntax

ls [options] (PATH)

"Common Options"

-L Long text view file =windows Right-click Property-D View directory PS: General mate-L use-A To view all files under directory (including hidden files)-I display index number (inode)-F to file and identify-T to file modification time sort-R Reverse sort-K displays size in K units

Instance

View/etc/recently modified files and display them in a long format

[[email protected] ~]# ls-lrt/etc/#内容太多, see the effect yourself

View the properties of the/root directory

[Email protected] etc]# ls-ld/root dr-xr-x---. 7 root root 4096 APR 2 00:12/root

Show All Files under/root

[[Email protected] ~]# ls -latotal 116dr-xr-x---.    7  root  root  4096 apr 2 00:12  .dr-xr-xr-x.  26  root  ROOT  4096 APR 2 00:14 &NBSP, .... drwxr-xr-x   2  root root  4096 apr 2 00:12   A-RW-------.   1  root root  1106 Mar 1903:15    Anaconda-ks.cfg-rw-r--r--.   1  root root    9 apr 1  02:51  a.shdrwxr-xr-x   2  root root  4096 apr  2 00:12  B-RW-------.   1  ROOT ROOT  4147 APR  2 00:12  .bash_history-rw-r--r--.   1  root root    18 may 20 2009  .bash_logout-rw-r--r--.   1  root root   176 may 20 2009  .bash_ Profile-rw-r--r--.   1  root root   176 sep 23 2004   .BASHRC ...

Extended : The default is no parameter, which indicates the current directory to . the file at the beginning represents the hidden file

" the little tricks of ls command"

View all directories below root does not contain files

[[email protected] ~]# ls -lf              #<--the directory with the-F label total 72drwxr-xr-x  2 root root  4096 &NBSP;APR&NBSP;2&NBSP;00:12&NBSP;A/-RW-------.   1 root root  1106 Mar  19 03:15 anaconda-ks.cfg-rw-r--r--. &NBSP;&NBSP;1&NBSP;ROOT&NBSP;ROOT&NBSP;&NBSP;&NBSP;9&NBSP;APR  1 02:51 A.shdrwxr-xr-x  2 root root  4096 Apr 2  00:12 b/-rw-r--r--.   1 root root    9 apr 1 02:51  b.shdrwxr-xr-x  2 root root  4096 apr 2 00:12 c/- Rw-r--r--.   1 root root   28 Apr 1 03:38  Date.txt-rw-r--r--.   1 root root  23040 Mar 19 03:15  Install.log-rw-r--r--.   1 root&Nbsp;root  6240 mar 19 03:12 install.log.syslogdrwxr-xr-x  2 root  root  4096 apr 1 21:46 test/-rw-r--r--.   1 root root    16 apr 1 02:17 test.txt[[email protected] ~]# ls -lf |grep /     #<--grep's role in this is to filter content that contains "/",  "|" The role of LS&NBSP;-LF is to submit the contents of the content to grep processing drwxr-xr-x  2 root root  4096 apr 2  00:12 a/drwxr-xr-x  2 root root  4096 apr 2 00:12 b/ drwxr-xr-x  2 root root  4096 apr 2 00:12 c/drwxr-xr-x   2 root root  4096 apr 1 21:46 test/

Extension: This method understands the-F effect to the file plus identity


Summary

    1. The function of LS is to view a file or directory.

    2. The view directory needs to be added-D not in the view directory.

    3. -L can view the details of a file or directory, which is equivalent to the right-click property of Windows.

    4. With-LRT, you can view recently modified files.

    5. The hidden file is in "." The beginning of the file.

    6. | Role is to be | The preceding content is submitted to | To be dealt with later.

"Small Command big role" Next preview: Touch Create file

This article is from "Evan" blog, please make sure to keep this source http://ievan.blog.51cto.com/11177578/1762329

"Small Command Big effect" the third LS command-view directory or file

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.