In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Linux under the directory content of the command", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "Linux under the directory content command" bar!
Ls
The most common command in Linux to list the contents of a directory is the ls command. By default, ls displays all non-hidden content in the directory. In the display results, files and directories will be displayed in different colors, depending on the terminal's color theme.
Ls
The ls command lists the contents of the current directory. If you want to view the contents of other directories, you can specify a specific path in the command:
$ls / other / directory / path
If you want to see the hidden content in the directory, you can add the-an option:
$ls-a
You can also use the-l option to list the contents of the current directory in the form of a list, and the file size listed at this time will be displayed in bytes, which is very inconvenient to read. We can add the-h option to display the file size in a form that is easy for humans to read, such as k, M, G, and other easy-to-read units.
Of course, for convenience, you can directly combine the two options into one.
$ls-lh
Dir
Ls commands are familiar to everyone, and they are used very frequently. The dir command is similar to the ls command in that it lists the contents of the directory. If the listed file name contains special characters, such as spaces, a backslash\ will be displayed before these special characters.
Dir is similar to ls, and the command parameters in the ls command are also available in dir.
Dir
In fact, the dir command is equivalent to the following command:
$ls-C-b
Where:
-C: displays the content as a column
-b: add a backslash before the special character\
Vdir
The vdir command displays the contents of the directory in a long list, and the special characters are preceded by a backslash\. The long list shows the permission information, number of connections, owner, group owner, file size, last modified time, and name of the file or directory.
Vdir
The vdir command has the same effect as the following ls command:
$ls-l-b
Where:
-l: displays the contents of the directory as a list
-b: precede special characters with a backslash\
The significance of dir and vdir
See here, you must have a question, since the ls command can achieve all the functions of dir and vdir, then what is the point of these two?
Shell commands are often part of scripts whose output is sometimes displayed on the terminal, redirected to a file, or simply piped to other commands.
However, in some cases, the ls command does not get the expected results due to performance problems when the script is executed. Therefore, Linux developers have developed these two commands, and using these two commands will not encounter that kind of performance problem.
Some other knowledge
When we use the ls command to view the contents of the directory, different types of files are displayed in different colors, while with the dir and vdir commands, all the contents are the same color. This is because by default ls is actually an alias for ls-- color=auto, so the output is configured with a color.
Alias
If you also want the output to be displayed in different colors by type when using dir and vdir, you can use:
$dir-- color $vdir-- color
Thank you for your reading, the above is the "Linux under the directory contents of the command", after the study of this article, I believe that you have a deeper understanding of the Linux under the command of the contents of the directory, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.