Linux View directory four ways (LS only show directory) _linux Shell

Source: Internet
Author: User *

Copy Code code as follows:

amosli@amosli-pc:~$ ls-d *
%appdata% Develop many Sorted.txt workspace
Bank Documents Music Space Download

2. Find.-type d-maxdepth 1

If you do not add-maxdepth parameters, then there will be an infinite number of directories are listed.

Copy Code code as follows:

amosli@amosli-pc:~$ find. -type d-maxdepth 1

./music | grep '/$ '

Using the Linux piping command, grep looks for the '/$ '/end, which is also the directory

Copy Code code as follows:

amosli@amosli-pc:~$ Ls-f | grep '/$ '
documents/ | grep ' ^d '

Copy Code code as follows:

amosli@amosli-pc:~$ Ls-l | grep ' ^d '

Drwxr-xr-x 3 Amosli amosli 4096 June 2013%appdata%
Drwxr-xr-x Amosli amosli 4096 December 17:44 Bank
Drwxr-xr-x 4 Amosli amosli 4096 December 00:33 Desktop
Drwxrwxr-x Amosli amosli 4096 December 19:11 Develop
Drwxr-xr-x 3 Amosli amosli 4096 July 9 00:58 Documents

Related Article

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: 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.