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

Instructions for creating and deleting commands for Linux directories

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "Linux directory creation and deletion command instructions". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

mkdir command

mkdir is used to create one or more directories

Syntax:

grammar is

mkdir [command switch] directory

Command switches:

-m text directory set operation permissions-p If parent directories do not exist, create them at the same time. - v Output information about each directory created

Examples:

Create directory:

mkdir test

The above command will create the directory 'test'.

Create directories and set access rights:

mkdir -m 666 test

The above command creates the directory 'test' and sets read and write permissions.

rmdir command

The rmdir command is used to delete/remove directories and their subdirectories.

Syntax:

grammar is

rmdir [command switch..] directory name

Command switches:

-p Allows users to delete dirname directories, if the directory above the directory has become empty directory, then delete it.

Examples:

Delete/remove directories.

rmdir tmp

If the tmp directory is empty, rmdir removes/deletes the tmp directory.

Delete tree:

rm -ir tmp

This command recursively deletes the contents of all subdirectories in the tmp directory, prompting you to delete each file, and then deletes the tmp directory itself.

CD command

The cd command is used to change directories.

Syntax:

grammar is

cd [directory name]| ~ | ./ | ../ | - ]

Command switches:

-L Use tree directory structure. - P-enforced signature connection.

Examples:

cd linux-command This command (linux-command) changes from its parent directory to its child directory.

cd .. This will change from the current working directory/subdirectory to the parent directory.

cd ~ This command will change to the user's home directory "/home/username"

PWD command

pwd-Displays the working directory. The pwd command displays the absolute path name of the current working directory.

Syntax:

grammar is

pwd [command switch]

Command switches:

-P Displays path names that do not contain symbolic links. - L Displays path names that contain symbolic links.

Examples:

Displays the current working directory.

pwd If you are working in your home directory, the pwd command shows that your current working directory is/home.

LS command

ls command files and directories in the current working directory.

Syntax:

grammar is

ls [command switch]… [file]

Command switches:

-l Lists all files, directories and their mode, number of connections, file owner, file size, date and time of file modification, and file name. - tLists files and directories sorted by the time they were modified. - a Lists all items, including hidden files. - d Lists catalog files rather than their contents. - p Add slash at end of directory. - u Lists files and directories sorted by last modified time. - i Lists node information. - ltr Lists files sorted by date. - lSr Lists files sorted by file size.

Examples:

Show the contents of the root directory:

ls /Lists the contents of the root directory.

Show hidden files and directories:

ls -a Lists all entries, including implied files and directories.

Display node information:

ls -i7373073 book.gif

7373074 clock.gif

7373082 globe.gif

7373078 pencil.gif

7373080 child.gif

7373081 email.gif

7373076 indigo.gif

The above command displays the file name as well as the file size.

"Linux directory creation and deletion command instructions" on the content of the introduction here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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