1.不知道rm用法可以用 man rm 2.删除指定文件 rm 文件默认 -i,输入Y就是删除文件,N就是不删除
[root@centos6 /]# cd /demo
[root@centos6 demo]# ll -st
total 12
4 -rw-r--r--. 1 root root 13 Oct 26 06:54 demo1.txt
4 -rw-r--r--. 1 root root 12 Oct 26 06:54 demo.txt
4 drwxr-xr-x. 4 root root 4096 Oct 26 04:56 a
[root@centos6 demo]# rm demo1.txt
rm: remove regular file `demo1.txt'? y 3.删除文件显示运行时详细信息
[root@centos6 demo]# rm -v demo.txt
rm: remove regular file `demo.txt'? Y
removed `demo.txt'
[root@centos6 demo]# 4.递归删除某个目录下文件以及子目录,一般和 -rf一起使用 不加f就要询问是否删除
[root@centos6 demo]# tree a
a
|-- b
| `-- c
`-- d
`-- v
`-- d
`-- d
`-- d
`-- d
8 directories, 0 files
[root@centos6 demo]# rm -rf a/b
[root@centos6 demo]# tree a
a
`-- d
`-- v
`-- d
`-- d
`-- d
`-- d
6 directories, 0 files 4.删除目录下带.txt的文件
[root@centos6 demo]# tree .
.
|-- a
| `-- d
| `-- v
| `-- d
| `-- d
| `-- d
| `-- d
|-- a.txt
|-- b.txt
|-- c.txt
`-- d.txt
7 directories, 4 files
[root@centos6 demo]# rm -f *.txt
[root@centos6 demo]# tree .
.
`-- a
`-- d
`-- v
`-- d
`-- d
`-- d
`-- d
7 directories, 0 files