RM command
rmdir
Commands are limited, only non-empty directories can be deleted, and files cannot be deleted. rm
The command is more than good, you can delete any directory and files. Need some awesome options!
RM-RF/
  this command never knocks!!!!
RM-RF/
  this command never knocks!!!!
rm -rf /
This command must never be knocked!!!!
1. deleting files
[Email protected] ~]# rm/tmp/allin/2/3/1.txt RM: Do you want to delete the plain empty file "/tmp/allin/2/3/1.txt"? Y[[email protected] ~]# tree/tmp/allin/tmp/allin├──1│└──2└──2└──34 directories, 0 files
[[email protected] ~]# rm /tmp/allin/2/3rm: Unable to delete "/TMP/ALLIN/2/3": is a directory [[email protected] ~]# rm /tmp/allin/2/3/1.txt 2.txt [[email protected ] ~]# rm /tmp/allin/2/3/1.txt 2.txt [[email protected] ~]#  RM /TMP/ALLIN/2/3/*.TXTRM: Do you want to delete the normal empty file "/tmp/allin/2/3/1.txt"? NRM: Do you want to delete the normal empty file "/tmp/allin/2/3/2.txt"? N
[Email protected] ~]# TREE/TMP/ALLIN//TMP/ALLIN/├──1│└──2└──2└──3├──1.TXT└──2.TXT4 Director IES, 2 files[[email protected] ~]# rm-f/tmp/allin/2/3/*.txt[[email protected] ~]# tree/tmp/allin//tmp/allin/├──1│└─ ─2└──2└──34 directories, 0 files
2. Deleting a directory
[[email protected] ~]# rm/tmp/allin/2/3/rm: Cannot delete '/tmp/allin/2/3/': is a directory
There will be an error. Because it is a non-empty directory.
[[EMAIL PROTECTED] ~]# RM -R /TMP/ALLIN/2/3/RM: Do you want to delete the directory "/tmp/allin/2/3/"? y[[email protected] ~]# !treetree /tmp/allin//tmp/allin/├── 1│ └── 2└── 23 directories, 0 files
[Email protected] ~]# rm-rf/tmp/allin/2[[email protected] ~]#!treetree/tmp/allin//tmp/allin/└──1└──22 Directori ES, 0 files
[[EMAIL PROTECTED] ~]# RM -RFV /TMP/ALLIN/1 deleted directory: "/TMP/ALLIN/1/2" deleted directory: "/TMP/ALLIN/1 "[[Email protected] ~]# ls /tmp/allin/[[email protected] ~]# !treetree /tmp/allin//tmp/allin/0 directories, 0 files
-f
options are awesome, but be sure to use them with caution.
-f
Some of the disadvantages of the options
[[email protected] ~]# tree/tmp/allin/tmp/allin0 directories, 0 files[[email protected] ~]# rm-f/TMP/ALLIN/2
Expand your knowledge
history
command, the user views the history of previously used commands.
650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/201706052225_662.png "style=" border-style:none; "/>
!+ command to quickly use the last command.
[[email protected] ~]#!treetree/tmp/allin/tmp/allin0 directories, 0 files[[email protected] ~]#!lsls/tmp/allin/[[emai L protected] ~]#!historyhistory 1 ls 2 ls/tmp 3 ls/boot 4 LS/5 dhclient
This article is from the "Linux Road" blog, make sure to keep this source http://allin28.blog.51cto.com/12931477/1933846
Linux RM Command