In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Linux directory management-related commands, which have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
First of all, enter cd / mnt, enter the / mnt directory, because the default / mnt is empty, the experimental effect is obvious, and will not affect the system itself, which is conducive to subsequent experiments.
(1) create a directory
The format of the create directory command is as follows:
Mkdir directory
① mkdir D1 D2 D3: create multiple directories D1, D2, D3.
② mkdir-p d5/d6: create a directory d5jjjjp means that if the parent directory d5 of D6 does not exist, then create a parent directory as well.
(2) Delete the directory
The format of the delete directory command is as follows:
Rm directory
Rm-rf D1, d2, d3, d5: delete directories D1, d2, d3, d5. -r means that subdirectories and their files are allowed in the deleted directory,-f means forced deletion without asking, and if-r and-f are used together, they can be written in the form of-rf.
Note that you can also use the rmdir command to delete directories, but rmdir can only delete empty directories, usually not.
(3) copy the directory
The format for copying the source directory to the destination directory is as follows:
Cp-r source destination
① cp-r D1 d2/d3: copy directory D1 to directory D2 and rename it D3.
② cp-r D1 D2: copy directory D1 to directory D2 without changing its name.
This is shown in the following figure.
After the cp-r D1 d2/d3 command is executed, because the directory D2 is empty and the destination directory D3 does not exist, the purpose of this command is to copy the D1 directory to the D2 directory, and then rename the D1 directory to D3.
After the cp-r D1 D2 command is executed, because the destination directory D2 already exists, the purpose of this command is to copy the entire D1 directory and its contents to the D2 directory.
Note that when copying a directory, it is copied if the specified target directory does not exist; if the target directory already exists, it is copied and saved to the target directory.
(4) move the directory
Cut and paste the source directory into the destination directory in the following format:
Mv source destination
① mv D1 d2/d3: move directory D1 to directory D2 and rename it D3.
② mv D1 D2: move directory D1 to directory D2 without changing its name.
Note that when moving a directory, it is moved if the specified target directory does not exist; if the target directory already exists, it is moved and saved to the target directory.
Thank you for reading this article carefully. I hope the article "what are the commands related to Linux directory management" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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.
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.