1
2
|
[root@hpf-linux ~] # which cat /bin/cat |
1
2
|
[root@hpf-linux ~] # whereis passwd passwd : /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd .1.gz |
1
2
|
[root@hpf-linux ~] # whereis -b passwd passwd : /usr/bin/passwd /etc/passwd |
1
|
[root@hpf-linux ~] # yum -y install mlocate |
1
2
3
4
5
6
7
8
9
10
11
|
[root@hpf-linux ~] # updatedb [root@hpf-linux ~] # echo $? 0 [root@hpf-linux ~] # locate passwd /data/www/source/module/member/member_getpasswd .php /data/www/source/module/member/member_lostpasswd .php /data/www/template/default/forum/forumdisplay_passwd .htm /data/www/template/default/member/getpasswd .htm /etc/passwd /etc/passwd- .......................... |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
查找 /var 目录中属主为root且属组为mail的文件 [root@hpf-linux ~] # find /var -user root -group mail 查找 /usr 目录下不属于root、bin的所有文件 [root@hpf-linux ~] # find /usr -not -user root -not -user bin 查找 /etc 目录中最近一周内其内容修改过的,且不属于root文件 [root@hpf-linux ~] # find /etc -mtime -7 -not -user root 查找当前系统上没有属组或属组,且最近一个月内被访问过的文件 [root@hpf-linux ~] # find -nouser -atime -30 -o -nogroup -atime -30 查找早 /etc/ 目录下大于1M且类型为普通文件的所有文件 [root@hpf-linux ~] # find /etc/ -type f -size +1M 查找 /etc/ 目录所有用户都没有写权限的文件 [root@hpf-linux ~] # find /etc/ -not -perm +222 查找 /etc/ 目录下至少一类没有写权限的文件 [root@hpf-linux ~] # find /etc/ -perm -222 查找 /etc/init .d目录下,所有用户都有执行权限其其他用户有写权限的文件 [root@hpf-linux ~] # find /etc/init.d/ -perm -111 -perm -002 或者 find /etc/init .d/ -perm -113 查询当天修改过的文件并列出文件的属性 [root@hpf-linux ~] # find ./ -mtime -1 -type f -exec ls -l {} \; 上例中使用-ok参数,查询到结果后可以手动输入是否输出结果: [root@hpf-linux ~] # find ./ -mtime -1 -type f -ok ls -l {} \; < ls ... ./.bash_history > ? [root@hpf-linux ~] # find ./ -mtime -1 -type f -ok ls -l {} \; < ls ... ./.bash_history > ? yes -rw-------. 1 root root 16294 7月 11 06:35 ./.bash_history |