1.1 Moving files
Move the/data directory to/root
Command MV involved
[[Email protected] ~] # mv/data//root/ Mobile [[email protected] ~]# ls/root/ view anaconda-ks.cfg Data Install.log install.log.syslog[[email protected]-50 ~]#
1.2 Backing up files
Backup Oldboy.txt
Command CP involved
[[Email protected] ~] # ########## backup CP will need to back up the file plus . bak[[email protected]-50 ~]# ls-l/root/data/ check total 0-rw-r--r--. 1 root root 0 Jul 19:18 oldboy.txt-rw- R--r--. 1 root root 0 Jul 19:19 oldboy.txt.bak[[email protected]-50 ~]#
1.3 Renaming
Modify Oldboy.txt to Oldgirl.txt
[[Email protected] ~] # ########## backup CP will need to back up the file plus . bak[[email protected]-50 ~]# ls-l/root/data/ check total 0-rw-r--r--. 1 root root 0 Jul 19:18 oldboy.txt-rw- R--r--. 1 root root 0 Jul 19:19 oldboy.txt.bak[[email protected]-50 ~]#
1.4 Deleting files
Delete Oldgirl.txt
The command RM parameter-F is involved
[[Email protected] ~] # rm/root/data/oldgirl.txt Delete files rm:remove regular empty file '/root/data/oldgirl.txt'? y Confirm Delete y [[Email protected] ~] #
Force Delete Does not prompt
[[Email protected] ~] # rm-f/root/data/oldgirl.txt Force Delete does not prompt [[email protected] ~]# ls-l/root/data/ View Total 0-rw-r--r--. 1 root root 0 Jul 19:19 oldboy.txt.bak[[email protected]-50 ~]#####-f Force Delete does not prompt
1.5 Deleting a directory
Delete the/data under/tmp
Involved Command RM
-RF forced deletion is not prompted (use caution during work)
-R Recursively Delete directories and the following files
-F Force Delete does not prompt
[[Email protected] ~] # rm/tmp/data/ Rm:cannot remove '/tmp/data/': is directory This is a directory cannot be deleted directly directory [[email protected] ~]# rm-r/tmp/data/- R recursively deletes directories and the following files rm:remove directory '/tmp/data'[[Email Protected] ~]#[[email protected]-50 ~]# rm-rf/tmp/data/ -rf Forced deletion without prompting (use with caution!) )[[email protected] ~]#
1.6 mkdir Command Supplement
Create a multi-tier catalog (bulk create Catalogs)
-P Create multi-level catalogs
-V Show creation process
[[Email protected] ~] # mkdir-p/oldboy/test [[Email protected] ~] # [[Email protected] ~] # #-p Creating a multi -level catalog
Create a multi-tiered catalog and display the creation process
[[Email protected] ~] # mkdir-pv/1/2/3mkdir:created directory '/1'mkdir:created directory '/1/2'mkdir:created Directory '/1/2/3'[[email protected] ~]# #- v show creation process
1.7 CD Command Supplement
CD: Go to the top level directory
[[Email protected] ~] # cd/root/data/ [[email protected] data] # CD.. [[Email protected] ~] # # #进入到上一级目录
CD. Go to the current directory
[[email protected] data] # CD. [[email protected] data] # # #进入到当前目录 [[email protected] data] # # when the #用到cd. [[email protected] data] # # #移动xxxx文件 to the current directory [[email protected] data] # cp/root/data/oldboy.txt. # # # # # # # # #可能使用到的地方 If you are currently copying a file to data in the data directory, you can use it. Instead of the path you want to copy
Linux Basic command file management lower