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 linux basic commands

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to use linux basic commands". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use linux basic commands.

Ls

The ls command lists files and directories. By default, he lists the contents of the current directory. With the parameters, we can do more with ls.

For example, when we have just changed a file but can't remember which file it is, we can use the command: ls-ltr to list the details of files and folders by modification time.

So let's take a look at the specific use of the ls command.

Format: ls [- alicfbd] [file or directory]

Function: display a list of directories

Options:

-a: show all files and directories

-c: display the output result in multiple columns. This is the default option

-d: displays only the directory name, not the list of contents under the directory

-I: displays the file index node number (inode). An Inode represents a file

-k: displays the file size in KB (kilobytes)

-l: displays the list of contents under the directory in a long format

-m: separate the names of each file and directory with the "," sign

-n: replace its name with user identification code and group identification code

-s: displays the size of files and directories in chunks

-t: sort by the change time of files and directories

-L: if you encounter a file or directory with a symbolic link, directly list the original file or directory that the link points to

-r: recursive processing that processes all files and subdirectories under the specified directory

-- full-time: list the complete date and time

-- color [= WHEN]: highlight different types of

Example 1: show all files in the current directory, including hidden files

[root@vhxct67test1] # ls-a

. ..

Example 2: display the file and its details

[root@vhxct67test1 ~] # ls-l / mnt

Total 4

Lrwxrwxrwx 1 root root 11 Nov 24 08:13 b.txt-> / test/b.txt

Drwx-. 2 root root 4096 Aug 2 04:34 hgfs

Red font comments:

Column 1

The following nine characters are about file permissions. The first three rwx characters are the permissions of the owner of the file, the second set of 3rwx is the permissions of all groups of the file, and the last rwx is the permission for others to access the file.

The first letter d means that the content is a directory or file.

The second column tells us how many links there are to this file.

The third column tells us who is the owner of this file / folder.

Column 4 tells us who is all the groups in this file / folder.

The fifth column tells us the size of the file / folder in bytes. The size of the directory is always 4096 bytes.

Column 6 tells us when the file was last modified.

Column 7 tells us the name of the file or directory.

Example 3: highly readable display

[root@vhxct67test1 ~] # ls-lh

Rw-. 1 root root 1.4K July 16 00:28 anaconda-ks.cfg

Example 4: list files and mark color categories

[root@vhxct67test1] # ls-- color=auto

There are many uses of ls command, flexible use will reduce a lot of tedious work.

For example, classify according to special characters

# ls-F

At this point, I believe you have a deeper understanding of "how to use linux basic commands". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Internet Technology

Wechat

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

12
Report