[root@localhost ~]# find /etc -name init
/etc/sysconfig/init
试验通配符和占位符
[root@localhost ~]# find /etc -name init*
/etc/selinux/targeted/contexts/initrc_context
/etc/sysconfig/init
/etc/sysconfig/network-scripts/init.ipv6-global
/etc/init.d
/etc/mail/spamassassin/init.pre
/etc/inittab
/etc/initlog.conf
/etc/rc.d/init.d
[root@localhost ~]# find /etc -name init???
/etc/inittab
[root@localhost ~]# find /etc -name init?
[root@localhost ~]# find /etc -name init??
/etc/init.d
/etc/rc.d/init.d
查找用户
[root@localhost ~]# find /home -user helen
/home/helen
/home/helen/.bash_logout
/home/helen/.kde
/home/helen/.kde/Autostart
/home/helen/.kde/Autostart/.directory
/home/helen/.mozilla
/home/helen/.mozilla/extensions
/home/helen/.mozilla/plugins
/home/helen/.bash_profile
/home/helen/.bashrc
/home/helen/.bash_history
测试转义字符
[root@localhost ~]# which rm
alias rm='rm -i'
/bin/rm
[root@localhost ~]# rm abc.txt
rm: remove regular empty file `abc.txt'?
[root@localhost ~]# \rm abc.txt
查找二进制文件
[root@host141 ~]# find /etc -name init* -a -type f
/etc/inittab
/etc/initlog.conf
/etc/sysconfig/network-scripts/init.ipv6-global
/etc/sysconfig/init
/etc/selinux/targeted/contexts/initrc_context
测试连接符-exec
[root@localhost ~]# find /etc -name inittab
/etc/inittab
[root@localhost ~]# find /etc -name inittab -exec ls -l {} \;
-rw-r--r-- 1 root root 1666 Feb 14 04:02 /etc/inittab
[root@localhost ~]# cd /test
[root@localhost test]# pwd
/test
[root@localhost test]# ls
a a.hard a.soft etc issue lost+found
[root@localhost test]# find /test -name a.soft
/test/a.soft
[root@localhost test]# find /test -name a.soft -exec rm {} \;
[root@localhost test]# ls
a a.hard etc issue lost+found
测试连接符-ok
[root@localhost test]# find /etc -name inittab -exec ls -l {} \;
-rw-r--r-- 1 root root 1666 Feb 14 04:02 /etc/inittab
[root@localhost test]# find /etc -name inittab -ok ls -l {} \;
< ls ... /etc/inittab > ? y
-rw-r--r-- 1 root root 1666 Feb 14 04:02 /etc/inittab
[root@localhost test]# ls
a a.hard etc issue lost+found
[root@localhost test]# find /test -name a.hard -ok rm {} \;
< rm ... /test/a.hard > ? y
[root@localhost test]# ls
a etc issue lost+found
[root@localhost test]# find /etc -name init* -a -type f -exec ls -l {} \;
-rw-r--r-- 1 root root 28 Apr 10 2010 /etc/selinux/targeted/contexts/initrc_context
-rw-r--r-- 1 root root 1068 Jul 4 2009 /etc/sysconfig/init
-rwxr-xr-x 1 root root 5433 Jul 4 2009 /etc/sysconfig/network-scripts/init.ipv6-global
-rw-r--r-- 1 root root 1299 Jan 21 2009 /etc/mail/spamassassin/init.pre
-rw-r--r-- 1 root root 1666 Feb 14 04:02 /etc/inittab
-rw-r--r-- 1 root root 658 Sep 29 2009 /etc/initlog.conf
测试根据i节点删除文件
[root@localhost test]# touch "a b";
[root@localhost test]# ls
a a b
[root@localhost test]# touch -- -abc
[root@localhost test]# ls
a a b -abc
[root@localhost test]# rm -abc
rm: invalid option -- a
Try `rm ./-abc' to remove the file `-abc'.
Try `rm --help' for more information.
[root@localhost test]# rm a b
rm: remove regular empty file `a'? a
rm: cannot lstat `b': No such file or directory
[root@localhost test]# rm a b
rm: remove regular empty file `a'? y
rm: cannot lstat `b': No such file or directory
[root@localhost test]# rm -- -abc "a b"
rm: remove regular empty file `-abc'? y
rm: remove regular empty file `a b'? y
[root@localhost test]# ls
[root@localhost test]#
[root@localhost test]# ls -i
1653280 a b 1653352 -abc
[root@localhost test]# find . -inum 1653280
./a b
[root@localhost test]# find . -inum 1653280 -exec rm {} \;
[root@localhost test]# ls
-abc
|