Summary Linux command list
Linux command to delete files and directories. "rm" is an abbreviation for "remove".
/home/hoge
#Check the contents of the directory
$ ls -l
-rw-r--r-- 1 hoge hoge 11 Feb 24 17:11 hoge.txt
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
# hoge.Delete txt
$ rm hoge.txt
#Confirm that it has been deleted
$ ls -l
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
option | Description |
---|---|
-f | Execute without displaying an error message(Danger) |
-i | Check before deleting |
-I | Check before deleting only when there are 4 or more deletion targets |
-r | Include directories to be deleted |
-v | View deletion details |
/home/hoge
#Check the contents of the directory
$ ls -l
-rw-r--r-- 1 hoge hoge 11 Feb 24 17:11 hoge.txt
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
# hoge.Delete txt
$ rm -i hoge.txt
remove hoge.txt? (y or n) y
#Confirm that it has been deleted
$ ls -l
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
/home/hoge
#Check the contents of the directory
$ ls -l
-rw-r--r-- 1 hoge hoge 11 Feb 24 17:11 hoge.txt
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
# hoge.Delete txt
$ rm -r test
#Confirm that it has been deleted
$ ls -l
-rw-r--r-- 1 hoge hoge 11 Feb 24 17:11 hoge.txt
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
/home/hoge
#Check the contents of the directory
$ ls -v
-rw-r--r-- 1 hoge hoge 11 Feb 24 17:11 hoge.txt
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
# hoge.Delete txt
$ rm -v hoge.txt
mooooo.tx
#Confirm that it has been deleted
$ ls -l
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:14 test
drwxr-xr-x 2 hoge hoge 4096 Feb 24 17:15 test2
/
#Try to ruin
$ cd /
$ sudo rm -rf /
pwd, mkdir, cd , cat, cp, ls, touch, less, mv, rm, ssh, man, ** Adding at any time **
We undertake various development and construction contracts and mentor work for beginners. If you are interested, please go to ** here **
Recommended Posts