Linux Learning Note: ls command

Source: Internet
Author: User
Tags locale syslog

The LS command is the most commonly used command to view a list of files and folders in the current or specified directory, including attributes, sorting.

-A view a list of all files and folders that are hidden.

[email protected] ~]# ls-a

. 100m.data

.. 1kfile.dat

-A is similar to A, but not displayed. and. These two special folders

[email protected] ~]# ls-a

0k 1Mfile

0kfile anaconda-ks.cfg

-B ignores files or folders that begin with the file name (~ starts with the backup file, folder)

[[email protected] ~]# ls

0k 100m.data 1Mfile install.log test~

[email protected] ~]# ls-b

0k 100m.data 1Mfile Install.log testparm.result

-C Display CTime (change time) and sort by file name when used with-l only

When mated with-lt, it is displayed and sorted by CTime

[email protected] ~]# LS-LC

Total 103600

-rw-r--r--. 1 root root 4 Feb 18:57 0k

-rw-r--r--. 1 root root 0 Feb 9 18:54 0kfile

-rw-r--r--. 1 root root 104857600 Feb 9 18:59 100m.data

-rw-r--r--. 1 root root 9 18:25 1kfile.dat

-rw-r--r--. 1 root root 1048576 Feb 9 18:50 1Mfile

-RW-------. 1 root root 1211 Jan 2 01:25 anaconda-ks.cfg

-rw-r--r--. 1 root root 27312 Jan 2 01:25 Install.log

-rw-r--r--. 1 root root 7572 Jan 2 01:25 install.log.syslog

-rw-r--r--. 1 root root 0 Feb 19:58 test~

-rw-r--r--. 1 root root 17746 Jan 3 18:37 Testparm.result

[email protected] ~]# LS-LTC

Total 103600

-rw-r--r--. 1 root root 0 Feb 19:58 test~

-rw-r--r--. 1 root root 4 Feb 18:57 0k

-rw-r--r--. 1 root root 104857600 Feb 9 18:59 100m.data

-rw-r--r--. 1 root root 0 Feb 9 18:54 0kfile

-rw-r--r--. 1 root root 1048576 Feb 9 18:50 1Mfile

-rw-r--r--. 1 root root 9 18:25 1kfile.dat

-rw-r--r--. 1 root root 17746 Jan 3 18:37 Testparm.result

-RW-------. 1 root root 1211 Jan 2 01:25 anaconda-ks.cfg

-rw-r--r--. 1 root root 27312 Jan 2 01:25 Install.log

-rw-r--r--. 1 root root 7572 Jan 2 01:25 install.log.syslog

-C Displays a list of files and folders by column

-D Mate-L displays information for the directory only, and if no directory is specified later, displays the current directory's

-F does not make any sort, and displays all files, folders, including hidden.

-F adds a special symbol to the end of different types of files and folders (*/=>@| )

= number represents socket file

[email protected] dev]# ll-f log

srw-rw-rw-. 1 root root 0 Feb 17:35 log=

[[email protected] dev]# file log

Log:socket

* Indicates a file with Execute permission (folder not counted)

[email protected] dev]# ll-f/usr/bin/

-rwxr-xr-x. 1 root root 9056 June yum-builddep*


/Number Represents folder

drwxr-xr-x. 2 root root 4096 Nov statetab.d/


--time-style=< Style > Display time is displayed in the specified style. The styles include the following:

Long-iso

[email protected] ~]# ls-l--time-style=long-iso

Total 103600

-rw-r--r--. 1 root root 4 2016-02-12 18:57 0k

-rw-r--r--. 1 root root 0 2016-02-09 18:54 0kfile

Full-iso

[email protected] ~]# ls-l--time-style=full-iso

Total 103600

-rw-r--r--. 1 root root 4 2016-02-12 18:57:37.000000000 +0800 0k

-rw-r--r--. 1 root root 0 2016-02-09 18:54:22.000000000 +0800 0kfile

ISO

[email protected] ~]# ls-l--time-style=iso

Total 103600

-rw-r--r--. 1 root root 4 02-12 18:57 0k

-rw-r--r--. 1 root root 0 02-09 18:54 0kfile

locale

[email protected] ~]# ls-l--time-style=locale

Total 103600

-rw-r--r--. 1 root root 4 Feb 18:57 0k

-rw-r--r--. 1 root root 0 Feb 9 18:54 0kfile

Custom

[[email protected] ~]# ls-l--time-style=+ '%y-%m-%d '

Total 103600

-rw-r--r--. 1 root root 4 2016-02-12 0k

-rw-r--r--. 1 root root 0 2016-02-09 0kfile

Sort by file Volume

-S default from the large to the small sort, if need to invert, can cooperate with the-R parameter

Show a different time

--time=<time type>,time type has atime, CTime, need to be used with-l, if this parameter is not used, the default display Mtime

Sort by different attributes

--sort=word

Sort by WORD instead of Name:none-u, Extension-x,

Size-s, Time-t, version-v

Word can be size, time, version, and if it is time, you need to mate with the--time parameter

[[email protected] ~]# ll-t--time-style=long-iso #按照mtime排序, from new to old, the style shown is Long-iso

-rw-r--r--. 1 root root 2016-01-16 10:59 fun.sh

-rw-r-xr--+ 1 root root 0 2016-01-11 22:18 testfile

-RWX------. 1 root root 171 2016-01-10 20:20 kickuser.sh

[email protected] ~]# ll--sort=time--time=ctime--time-style=long-iso #详写, sorted by time from new to old, The type of time is CTime (change time), and the display is in the style Long-iso

-rw-r--r--. 1 root root 111016 2015-10-09 23:26 httpd.txt

-rw-r--r--. 1 root root 1377 2015-10-04 11:28 netstat.after

-rw-r--r--. 1 root root 843 2015-10-04 11:26 Netstat.before



Linux Learning Note: 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.