标签:moved contents file cannot 存在 argument explain txt exp
rm命令可以删除一个目录中的一个或多个文件或目录,也可以将某个目录及其下属的所有文件及其子目录均删除掉。
注意:使用rm命令要格外小心。因为一旦删除了一个文件,就无法再恢复它。
[root@aminglinux ~]# which rm
alias rm=‘rm -i‘
/usr/bin/rm
语法
rm [options] name...
参数:
-r, -R, --recursive
remove directories and their contents recursively
(递归地删除目录及其内容)
-i
prompt before every removal
(在每次移除前提示)
-f, --force
ignore nonexistent files and arguments, never prompt
(忽略不存在的文件和参数,从不提示)
-v, --verbose
explain what is being done
(解释正在做什么)
示例:
[root@aminglinux sambo]# rm -v 1.txt
rm: remove symbolic link ‘1.txt‘? n
[root@aminglinux sambo]# ls
1.txt 3.txt dir1 dir2 dir3 passwd-soft
[root@aminglinux sambo]# rm -v 1.txt
rm: remove symbolic link ‘1.txt‘? y
removed ‘1.txt‘
[root@aminglinux sambo]# ls
3.txt dir1 dir2 dir3 passwd-soft
[root@aminglinux sambo]# rm -v dir1
rm: cannot remove ‘dir1‘: Is a directory
[root@aminglinux sambo]# rm -rv dir1
rm: remove directory ‘dir1‘? y
removed directory: ‘dir1‘
[root@aminglinux sambo]# ls
3.txt dir2 dir3 passwd-soft
[root@aminglinux sambo]# rm -rfv dir4
[root@aminglinux sambo]# rm -rfv dir1
removed ‘dir1/dir2/dir3/1.txt‘
removed ‘dir1/dir2/dir3/2.txt‘
removed ‘dir1/dir2/dir3/3.txt‘
removed directory: ‘dir1/dir2/dir3‘
removed directory: ‘dir1/dir2‘
removed directory: ‘dir1‘
标签:moved contents file cannot 存在 argument explain txt exp
原文地址:https://www.cnblogs.com/sambo510/p/9209232.html