您的位置:首页 > 其它

find命令高级用法

2017-02-06 20:32 295 查看
1. 目录和文件使用不同的权限

# 查找当前目录,所有文件类型为d[目录]的文件 执行命令 chmod 755
find .  -type d -exec chmod 755 {} \;
# 查找当前目录,所有文件类型为f[文件]的文件 执行命令 chmod 644
find .  -type f -exec chmod 644 {} \;


2. 删除不显示字符文件名的文件

find . -inum [inode] -exec rm {} \;


例子:

[root@localhost ~]# ls -il
total 420
202645692 -rw-r--r--  1 root root   4096 Jan 10 19:41 ??
[root@localhost ~]# find . -inum 202645692
./??
[root@localhost ~]# find . -inum 202645692 -exec rm {} \;
[root@localhost ~]# find . -inum 202645692
[root@localhost ~]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: