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 parse Linux files and manage them

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

How to parse Linux files and management, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Today, the editor will talk about some basic management of documents. The management of files and directories is almost like moving files or directories, deleting files, copying, and displaying attributes. Of course, the data of each user's home directory is very important. Let's look at the management of files and directories.

Ls [- ald] file name or directory name

If you are interested in going to Baidu on your own with so many parameters, I will write a few examples.

-a: all files, along with hidden files (beginning with. Listed together (commonly used)

-d: list only the directory itself, not the file data in the directory (commonly used)

-l: serial output of long data, including file attributes, permissions and other data; (commonly used)

Example 1:

The dot in front of the file in Linux represents the hidden file, and only ls-al can find the hidden file.

Example two

The function of F is to distinguish between directories and files, and there is a diagonal bar at the back of the directory.

Example question 3

-- full-time means that you can check the time when the file was modified and saved.

In addition to viewing the file directory, the most common thing for users is to copy and delete and move.

To copy files, use cp, the use of this command cp can be copied, you can also make shortcuts, compare the new and old, copy the entire directory.

Cp [- adfilprsu] Source file (source) object file (destination)

-s: copy as a symbolic link file (symbolic link), that is, a "shortcut" file

-r: recursive continuous replication for directory replication behavior; (commonly used)

-p: copy it along with the file's attributes (permissions, user, time) instead of using the default attributes (commonly used for backup)

-a: equivalent to-dr-- preserve=all. As for dr, please refer to the following instructions; (commonly used)

-I: if the target file (destination) already exists, the action will be asked first when overwriting (commonly used)

Example one

-I when the target exists,-I will ask the master to overwrite. Y is to confirm the overwrite.

Example 2:

To add a-an is to copy exactly the same, that is, to copy without changing anything.

You can give it a try if you don't add-a.

Example question 3:

Comparing with example 2, you can see that the command has a small difference. The owner of the directory and the owner of the group have become root.

And I copied the python directory also added-r, this is recursive replication, otherwise the directory can not be copied.

Example 4:

This cp is not really copied, but a soft connection, which is equivalent to the shortcut key of window, and this is very easy to use.

Rm [- fir] file or directory

-f: it means force. Ignore files that do not exist and there will be no warning messages.

-I: interactive mode, which asks the user whether to act before deleting it.

-r: delete it recursively! Most commonly used in directory deletion

Example 1:

Will prompt us before deleting, press y and it will be deleted.

Example 2:

The use of these two parameters-fr together is a very dangerous combination, indicating that the directory is forced to be deleted recursively and there is no prompt. When using this, you must think clearly about it. Many people delete the root directory directly, and it is too late to run away at that time!

Of course you have to use mv to move files.

Mv [- fiu] source file target file

-f: force force means that if the target file already exists, it will be overwritten without being asked.

-I: if the target file (destination) already exists, it will be asked whether to overwrite it!

Example 1:

Mv this command is window in the cut bar, very easy to use!

Example 2:

Mv can change its name while moving, this function is similar to cp, except that this is to move all the files or directories over and then change the name!

After reading the above, have you mastered how to parse Linux files and manage them? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Servers

Wechat

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

12
Report