命令简介:
rm命令用来删除Linux系统中的文件或目录。通常情况下rm不会删除目录,你必须通过指定参数-r或-R来删除目录。另外rm通常可以将该文件或目录恢复(注意,rm删除文件其实只是将指向数据块的索引点(information nodes)释放,只要不被覆盖,数据其实还在硬盘上。如果想要保证文件的内容无法复原,可以使用命令shred 。 另外一般还是要慎用rm -rf *这样的命令。
执行权限 :All User
指令所在路径:/bin/rm
命令语法:
rm [OPTION]... FILE...
命令参数:
参数
长参数
描叙
-f
--force
强制删除,忽略不存在的文件,从不给出提示。
-i
--interactive
交互模式删除文件,删除文件前给出提示。
-r
--recursive
递归的删除目录下面文件以及子目录下文件。
-R
--recursive
递归的删除目录下面文件以及子目录下文件。
-v
--verbose
显示运行时详细信息
--help
显示命令在线帮助
--version
显示命令版本信息
使用示例:
1:查看获取rm命令的帮助信息。
[root@DB-Server kerry]# man rmRM(1) User Commands RM(1) NAME rm - remove files or directories SYNOPSIS rm [OPTION]... FILE... DESCRIPTION This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped. OPTIONS Remove (unlink) the FILE(s). -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal --no-preserve-root do not treat 鈥"text-align: center">
6: 删除空目录
[root@DB-Server ~]# mkdir kerry [root@DB-Server ~]# rm -r kerry/ rm: remove directory `kerry/'? y
7:删除目录bdump下的所有trc文件类型的文件。
[oracle@DB-Server bdump]$ lsalert_GSP.log gsp_lgwr_20025.trc gsp_lgwr_5023.trc gsp_p000_4637.trc gsp_p000_4718.trc gsp_p000_5025.trc gsp_p001_4639.trc gsp_p001_4720.trc gsp_p001_5027.trcgsp_lgwr_19915.trc gsp_lgwr_4719.trc gsp_lgwr_5089.trc gsp_p000_4682.trc gsp_p000_4739.trc gsp_p000_5043.trc gsp_p001_4684.trc gsp_p001_4741.trc gsp_p001_5045.trc[oracle@DB-Server bdump]$ rm -v *.trcremoved `gsp_lgwr_19915.trc'removed `gsp_lgwr_20025.trc'removed `gsp_lgwr_4719.trc'removed `gsp_lgwr_5023.trc'removed `gsp_lgwr_5089.trc'removed `gsp_p000_4637.trc'removed `gsp_p000_4682.trc'removed `gsp_p000_4718.trc'removed `gsp_p000_4739.trc'removed `gsp_p000_5025.trc'removed `gsp_p000_5043.trc'removed `gsp_p001_4639.trc'removed `gsp_p001_4684.trc'removed `gsp_p001_4720.trc'removed `gsp_p001_4741.trc'removed `gsp_p001_5027.trc'removed `gsp_p001_5045.trc'
以上所述是本文给大家介绍的Linux命令学习总结之rm命令,希望对大家有所帮助。
更新日志
- 徐小凤.1997-金曲精选(康艺经典珍藏系列)【康艺成音】【WAV+CUE】
- 群星.1994-非常精丫宝丽金】【WAV+CUE】
- 《赛马娘 热血喧闹大感谢祭!》评测:现代复古派对
- 《星球大战:亡命之徒》评测:还是看看远方的光剑吧
- 《末日地带2》评测:酣畅淋漓的“和面”之旅
- 交错战线研发中心推荐角色一览
- 交错战线合成工厂推荐角色一览
- 战锤40K星际战士2狙击职业介绍|狙击职业技能效果一览
- RobertSaxtonTheResurrectionoftheSoldiers(2024)[24Bit-192kHz]FLAC
- 唐成杨东哥弹唱《情若真HQ》头版限量编号[WAV+CUE]
- 柏菲·HIFI风情1《一杯香茶》限量开盘母带ORMCD[WAV+CUE]
- 发糖了!《黑神话》动画导演绘制八戒紫蛛儿中秋贺图
- “时光系列”新作《时光3:永耀之境》首曝:画风更真实的恋爱模拟RPG
- 《战地》游戏主管:始终认为《战地》未来销量能超越《使命召唤》
- 《伤感民谣 值得收藏的音乐极品 2CD》[WAV/分轨][1.2GB]