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 manage files and directories in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Today, I will talk to you about how to manage files and directories in Linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Linux files and directories manage directories and paths

. On behalf of this layer directory.. Represents the upper level directory-represents the previous working directory ~ represents the home folder where the "current user identity" is located ~ account represents the home folder of the user account (account is an account name)

Let's talk about a few common instructions for processing directories:

Cd: changing directories

Pwd: displays the current directory

Mkdir: create a new directory

Rmdir: delete an empty directory

Cd (change directory, transform directory)

Variable about the executable file path: $PATH

Example: what is the search path listed with the identity of root?

[root@study ~] # echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If you want root to execute ls under / root in any directory, add / root to PATH. The way to join is simple, like this:

[root@study ~] # PATH= "${PATH}: / root" file and directory management

View of files and directories: ls

Copy, delete and move: cp, rm, mv

Consult the contents of the document

Cat displays the contents of the file from the first line

Tac displays from the last line, and you can see that tac is written backwards for cat!

When nl is displayed, output the line number by the way!

More displays the contents of the file page by page

Less is similar to more, but even better than more, it can turn the page forward!

Head only looks at the first few lines

Tail only looks at a few lines of tail.

Od reads the contents of the file in a binary way!

Modify the file time or create a new file: touch

The most commonly used touch directive is:

Create an empty file

Revise a file date to current (mtime and atime)

Default and hidden permissions for files and directories

File default permissions: umask

[root@study ~] # umask0022

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