linux常用命令(九)
1、which
[root@shell ~]# which ifconfig
/sbin/ifconfig
[root@shell ~]# which cp
alias cp='cp -i'
/bin/cp


2、find 命令用来在指定目录下查找文件。
只介绍最常用的部份。
-mtime -2 表示最近2天改过的文件
-ctime -2 : 在最近2天内被修改过的文件
d: 目录
f:文件
-name name : 文件名称符合 name 的文件。
-size +5k 查大于5k的文件
[root@shell ~]# find ./ -size +5k
./.viminfo
./install.log.syslog
./.subversion/servers
./.subversion/config
./.bash_history

3、查找当前目录不是文件夹的文件
[root@shell ~]# find ./ ! -type d
./employess
./.cshrc
./pass.txt
./.ssh/known_hosts

4、find ./ -type d -mtime -2 查找最近两天改过的文件夹
[root@shell ~]# mkdir 2019
[root@shell ~]# find ./ -type d -mtime -2
./
./2019

5、find ./ -empty 查找大小为0的文件
[root@shell ~]# find ./ -empty
./2019
./.java/.userPrefs/.user.lock.root

6、find . -type f -perm 644 -exec ls -l {} \; 查找文件权限为644的文件
[root@shell ~]# find . -type f -perm 644 -exec ls -l {} \;
-rw-r--r--. 1 root root 195 Dec 30 2017 ./employess
-rw-r--r--. 1 root root 100 Sep 23 2004 ./.cshrc
