【centos-36】rm命令

mac2022-06-30  22

man   rm

rm - remove files or directories        

-r, -R, --recursive           普通文件不能加 -r     删除目录则需要  -r remove directories and their contents recursively     移走目录和它们的内容(递归删除)

 

正确删除文件的姿势:

1.使用mv命令移动到/tmp(回收站,也就是移走备份。日后时间长远再删。)代替删除思维。

2.cd  目标目录       find . -type f(d) -name "test"|xargs rm      (别名生效在当前命令行时才生效,在这种组合管道命令中是生效不了的。)

为什么删除一个文件,提示是否要删除        有别名机制存在   

alias rm   运行命令,找到别名

以后写shell脚本命令删除文件的时候,也应该用find命令删除。

 

转载于:https://www.cnblogs.com/sec875/articles/9538032.html

最新回复(0)