Linux study notes - directory processing commands

1. mkdir command

mkdir make directions ---- create a directory

mkdir -p : Create a recursive directory, first create a directory that does not exist in the directory, and then create a directory in that directory

mkdir /tmp/test01/test02/ : create multiple commands at the same time

2. cd command

cd --- switch directory cd + directory name cd .. : return to the previous directory

3. pwd command

pwd print working direction --- display the current directory

4. rmdir command

rmdir remove empty directions --- remove a directory

Format: rmdir + [directory name]

5. cp command

cp copy --- copy command

cp -rp [source file or command] [target directory]

cp -r : copy directory

cp -p : copy file and keep file attributes

6. mv command

mv move -- cut or rename files

mv [source file or directory] [target directory]

mv[filename][new filename] : Copying a file in the same directory is a renaming of the file

 7. rm command

rm remove --- remove command        

rm -rf [file or directory], delete it directly without prompting

rm -r : delete the directory, you need to confirm before deleting

rm -f : delete files, you need to confirm before deleting, it is recommended that you use the latter two to prevent accidental deletion

Notice:

1. Planning should be made in advance when creating a directory to facilitate future maintenance

2. It is best to backup after deletion.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326395339&siteId=291194637