In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "Linux ls command how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Linux ls command how to use" this article.
1. Introduction to the use of ls command
Permissions for the ls command: all users.
Format: ls [option] [directory name].
Function: list all subdirectories and files in the target directory.
Option description:
-an is used to display all files and subdirectories (Paul point files).
-l in addition to the file name, the file permissions, owner, file size and other information are listed in detail.
-r displays the list of contents of the directory in reverse alphabetical order.
-t sort by file modification time, not by file name.
-An is the same as-a, but not listed "." (represents the current directory) and ".." Represents the parent directory of the current directory.
-F adds a flag after the file name and directory name listed. For example, add "*" after the executable file and "/" after the directory name to distinguish between different types.
-R if there are files in the target directory and its subdirectories, all files are listed.
-Cx sorts file names by line spread.
-CF lists the file names in the directory by column and appends a character to the file name to distinguish between the directory and the file type: the directory file name is followed by a slash (/). An asterisk (*) is appended to the executable file name. An @ symbol is appended to the symbolic link file name. No characters are appended to the normal file name.
-CR displays all files in the target directory and its subdirectories at all levels (directories and files can be called files), also known as recursive lists, in a column format.
Here are two examples of how the Linux ls command is used.
2. Examples of using ls command
Example 1: list the details of all the files and directories under the / home/cc/Ruijie folder.
[cc@cc] $ls-l-R / home/cc/Ruijie
After entering the above command, enter, the details of all the files in the directory will be displayed, as follows:
[cc@cc] $ls-l-R / home/cc/Ruijie
/ home/cc/Ruijie:
Total 2168
-rwxr-xr-x 1 cc cc 112876 2008-06-26 libpcap.so.0.6.2-rwxr-xr-x 1 cc cc 737192 2008-06-26 libstdc++.so.5-rwxr-xr-x 1 cc cc1938 2004-04-23 readme.txt
-rwxr-xr-x 1 cc cc 1350772 2005-08-31 xrgsu
[cc@cc ~] $
Beginners in the use of ls commands should pay attention to the format of the command: after the command prompt, the first is the command keywords, and then the command parameters, in the command parameters before there should be a short dash "-", all the command parameters have a specific role, they can choose one or more parameters, after the command parameters is the command operation object. In the above command "ls-l-R / home/cc/Ruijie", "ls" is the command keyword, "- l-R" is the parameter, and "/ home/cc/Ruijie" is the operator of the command. In this command, two parameters are used, "l" and "R". Of course, you can also use them together, as shown below:
[cc@cc ~] $ls-lR / home/cc/Ruijie
The result of this form is exactly the same as that of the above command form. In addition, if the operating object of the command is located in the current directory, you can operate on the operating object directly; if it is not in the current directory, you need to give the full path to the operating object, for example, in the above example, my current folder is the cc folder, and I want to operate on the Ruijie file under the cc folder. I can type ls-lR Ruijie directly or use ls-lR / home/cc/Ruijie.
Example 2: to list the details of all directories starting with "t" in the current directory, you can use the following command:
[cc@cc] $ls-l t*
In this way, you can view the information of all files in the current directory whose file names begin with "t".
In fact, in the command format, the contents in square brackets can be omitted. For the command ls, if you omit the command parameters and operands and type "ls" directly, a list of the contents of the current working directory will be listed.
The above is all the contents of the article "how to use the ls Command of 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.