Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the ways for linux to view the directory

Shulou Source: shulou.com Published: 2022-06-03 07:44:19 11月15日 Update

This article introduces the relevant knowledge of "what are the methods of linux to view the catalog". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1.ls-d *

The code is as follows:

Amosli@amosli-pc:~$ ls-d *

% APPDATA% develop many sorted.txt workspace

Bank Documents Music space download

2. Find. -type d-maxdepth 1

Without the-maxdepth parameter, an infinite number of directories will be listed.

The code is as follows:

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

. / Videos

. / Public

. /% APPDATA%

. / .kde

. / .gnome2

. / Music

3.ls-F | grep'/ $'

Using the linux pipe command, grep looks for a directory that ends with'/ $'.

The code is as follows:

Amosli@amosli-pc:~$ ls-F | grep'/ $'

% APPDATA%/

Bank/

Desktop/

Develop/

Documents/

4.ls-l | grep'^ d'

The code is as follows:

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

Drwxr-xr-x 3 amosli amosli 4096 June 22 2013 APPDATA%

Drwxr-xr-x 36 amosli amosli 4096 December 20 17:44 bank

Drwxr-xr-x 4 amosli amosli 4096 December 28 00:33 Desktop

Drwxrwxr-x 13 amosli amosli 4096 December 21 19:11 develop

Drwxr-xr-x 3 amosli amosli 4096 July 9 00:58 Documents

This is the end of the content of "what are the ways for linux to view the catalog". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Catalog code method content more knowledge practicality achievement next parameters commands dilemmas facts situations articles cases pipelines ribbons websites industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS OPPO Reno Shulou Tech Info Microsoft