1. One linux command per day ls

Source: Internet
Author: User

Ls-l-r/home/shiyanlou Ls-lr/home/shiyanlou

List all files and directories under the/home/shiyanlou folder for more information

Ls-l d*

Ls-l c*

Lists the details of all directories in the current directory that begin with "D", using the following command:

Ls-f/home/shiyanlou |grep/$

Show subdirectories of/home/shiyanlou

Ls-l/home/shiyanlou | grep "^d"

Ls-l/home/shiyanlou | grep ' ^d '

Show subdirectory details for/home/shiyanlou

List all files under the current working directory whose names are the beginning of G, and the newer the later, you can use the following command:

Ls-ltr g*

List all the files and directories under the current working directory; add "/" to the name, and the file name to add "*"

Ls-af

Calculate the number of files and directories in the current directory

Ls-l. | grep "^d" |wc-l

Ls-l. | grep "^-" |wc-l

Ls-l * |grep "^-" |wc-l (contains subdirectories)

Ls-l |grep "^-" |wc-l (as of the previous catalogue)

Ls-l * |grep "^d" |wc-l (when a subdirectory of the previous catalogue has a sub-catalogue)

Ls-l |grep "^d" |wc-l (2 subdirectories of the previous catalogue)

List absolute records of files (folders)

LS |sed "s:^: $PWD/:"

Lists the absolute path to all files (including hidden files) in the current directory, without recursion to the directory

Find $PWD-maxdepth 1 | Xargs Ls-ld

Recursively lists the absolute path of all files (including hidden files) under the current directory

Find $PWD | Xargs Ls-ld

Ls-tl–time-style=full-iso

Ls-ctl–time-style=long-iso

Display a list of color catalogs

Open/ETC/BASHRC and add the following line:

Alias ls= "Ls–color"

The next time you start bash, you'll be able to display a list of colored catalogs as you would in Slackware, where the meanings of colors are as follows:

1. Blue –> Directory

2. Green –> executable file

3. Red –> Compressed file

4. Light blue –> link file

5. Grey –> Other files

Show files, sort by file size

Ll-s

-h,–human-readable list file sizes in an easy-to-understand format (e.g. 1K 234M 2G)


Horizontal output

Shows the folder information of the previous folder

Ls-ld

List file and folder details by modified time

Recently modified files are displayed at the top

1. One linux command per day ls

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.