Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ls command in linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use ls commands in linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use ls commands in linux" this article.

Ls

If you know where the files are, you just need to list them or view information about them, and that's why ls is born.

Simply run ls to list all the visible files and directories in the current directory:

$lsDocuments Music Pictures Videos notes.txt

Add the-l option to view information about the file. At the same time, add the-h option to view the file size in a format that is easy for people to read:

$ls-lhtotal 60Kdrwxr-xr-x 2 adam adam 4.0K Nov 2 13:07 Documentsdrwxr-xr-x 2 adam adam 4.0K Nov 2 13:07 Musicdrwxr-xr-x 2 adam adam 4.0K Nov 2 13:13 Picturesdrwxr-xr-x 2 adam adam 4.0K Nov 2 13:07 Videos-rw-r--r-- 1 adam adam 43K Nov 2 13:12 notes.txt

Ls can also search for a specified location:

$ls Pictures/trees.png wallpaper.png

Or a specified file-- even if only part of the name:

$ls * .txtnotes.txt

What's missing? Want to view a hidden file? No problem, use the-an option:

$ls-a. .bash _ logout .bashrc Documents Pictures notes.txt.. .bash _ profile .vimrc Music Videos

Ls has many other useful options that you can combine to get the effect you want. You can learn more using the following command:

The above $man ls is all the contents of this article entitled "how to use ls commands in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report