[root@localhost demo]# rm a.txt #删除普通文件 rm: remove regular empty file ‘a.txt’? n [root@localhost demo]# rm a.txt b.txt #一次性删除多个文件 rm: remove regular empty file ‘a.txt’? n rm: remove regular empty file ‘b.txt’? n [root@localhost demo]# rm a.txt b.txt dir1/ [root@localhost demo]# rm dir1/ rm: cannot remove ‘dir1/’: Is a directory [root@localhost demo]# rm -r dir1/ #删除文件夹,加r参数,不加默认只删除文件 rm: descend into directory ‘dir1/’? n [root@localhost demo]# rm -d dir1/ #删除空文件夹 rm: cannot remove ‘dir1/’: Directory not empty [root@localhost demo]# rm -f a.txt #强制删除文件,且不提示 [root@localhost demo]# ls b.txt dir1 [root@localhost demo]# rm -rf ./* #强制删除当前目录下的所有文件 [root@localhost demo]# ls
标签:dir1,demo,常用命令,rm,txt,root,localhost From: https://www.cnblogs.com/wmqxlt/p/18642532