Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the Linux basic command ls

Shulou Source: shulou.com Published: 2022-06-01 13:59:21 09月11日 Update

Editor to share with you how to use the Linux basic command ls, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The ls command is the most commonly used command under linux. The ls command is the abbreviation of list  by default ls is used to print out the list of the current directory  if ls specifies another directory  then it will display a list of files and folders in the specified directory. Through the ls command, you can view not only the file  contained in the linux folder, but also the file permissions (including directories, folders, file permissions)  to view directory information, and so on. The ls command is often used in daily linux operations!

Linux basic ls command 1. Running the ls command without any parameters lists the contents of the current working directory:

* *

2. To list the contents of any directory, for example, the / etc directory uses the following command: $ls / etcls command details ls command details 3, a directory always contains some hidden files (at least two), so to display all files in the directory, use the-an or-all flag: $ls-als command details ls command details 4, you can also print out the details of each file For example, file permissions, number of links, owner name and group owner, file size, time last modified, and file / directory name:

This is set by the-l option, which means a list format as long as the screenshot below.

$ls-lls command detailed explanation ls command detailed explanation

Sort files based on date and time

1. To list files in a directory and sort the date and time of the last modification, use the-t option in the following command:

$ls-ltls Command details ls Command details 2. If you want a reverse sort file based on date and time, you can use the-r option to work like this: $ls-ltr

The above is all the contents of the article "how to use Linux basic commands ls". 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!

Tags: Commands files directories contents folders date time permissions articles sorting basis information name owner list face work not much two used in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux Apple macOS Microsoft