1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#手动更新locate数据库 [root@lovelace
scripts] #
updatedb #使用locate查找文件
(速度好快的说) [root@lovelace
scripts] #
locate *.py /home/scripts/factorial .py /home/scripts/input .py /usr/lib/python2 .4 /fileinput .py /usr/lib/python2 .4 /fileinput .pyc /usr/lib/python2 .4 /fileinput .pyo /usr/lib/python2 .4 /site-packages/dogtail/rawinput .py /usr/lib/python2 .4 /site-packages/dogtail/rawinput .pyc /usr/lib/python2 .4 /site-packages/dogtail/rawinput .pyo /usr/lib/python2 .4 /test/pyclbr_input .py /usr/lib/python2 .4 /test/pyclbr_input .pyc /usr/lib/python2 .4 /test/pyclbr_input .pyo /usr/lib/python2 .4 /test/test_fileinput .py /usr/lib/python2 .4 /test/test_fileinput .pyc /usr/lib/python2 .4 /test/test_fileinput .pyo |
1
2
3
4
5
6
|
[root@lovelace
scripts] #
find /tmp -name test /tmp/sources/httpd-2 .2.17 /srclib/apr-util/test /tmp/sources/httpd-2 .2.17 /srclib/apr/test /tmp/sources/httpd-2 .2.17 /modules/test /tmp/sources/httpd-2 .2.17 /test /tmp/test |
1
2
3
4
5
6
7
|
#查找/tmp目录下名字为test
而且文件格式为目录的 [root@lovelace
scripts] #
find /tmp -type d -a -name test /tmp/sources/httpd-2 .2.17 /srclib/apr-util/test /tmp/sources/httpd-2 .2.17 /srclib/apr/test /tmp/sources/httpd-2 .2.17 /modules/test /tmp/sources/httpd-2 .2.17 /test /tmp/test |
1
2
3
4
5
6
7
8
|
#查找/tmp目录下文件格式为目录,而且大小在26k到32k之间的目录 [root@lovelace
scripts] #
find /tmp -type d -a -size +16k -a -size -32k /tmp/sources/httpd-2 .2.17 /docs/manual/mod /tmp/sources/php-5 .2.13 /ext/reflection/tests /tmp/sources/php-5 .2.13 /ext/date/tests /tmp/sources/php-5 .2.13 /ext/spl/tests /tmp/sources/php-5 .2.13 /tests/classes /tmp/sources/php-5 .2.13 /Zend/tests |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#查找home目录下至少5天没被访问过的文件 [root@lovelace
scripts] #
find /home/ -ctime -5 /home/scripts /home/scripts/list /home/scripts/for /home/scripts/for/dir .sh /home/scripts/for/three .sh /home/scripts/for/checkbash .sh /home/scripts/for/sorsum .sh /home/scripts/while /home/scripts/while/readpasswd .sh /home/scripts/while/catwhile .sh /home/scripts/case /home/scripts/case/showmenu .sh /home/scripts/case/showmenu /home/scripts/case/2showmenu .sh /home/scripts/if /home/scripts/if/grade .sh /home/scripts/51cto /home/scripts/51cto/info .tt /home/scripts/51cto/info .sh /home/scripts/51cto/1 .sh /home/scripts/51cto/argument .sh /home/scripts/51cto/sum .sh |
1
2
3
4
5
6
7
8
9
|
#找出home中大小为16k到32k之间的文件,然后传递给exec
并显示出来 [root@lovelace
scripts] #
find /home/ -size +16k -a -size -32k -exec ls -lh {} \; -rw-r--r--
1 root root 20K 05-03 03:04 /home/nick/etc/gconf/gconf .xml.defaults/%gconf-tree-li.xml -rw-r--r--
1 root root 20K 05-03 03:04 /home/nick/etc/gconf/gconf .xml.defaults/%gconf-tree-ug.xml -rw-r--r--
1 root root 25K 05-03 03:04 /home/nick/etc/gconf/schemas/drivemount .schemas -rw-r--r--
1 root root 20K 05-03 03:04 /home/nick/etc/gconf/schemas/gnome-volume-control .schemas -rw-r--r--
1 root root 21K 05-03 03:04 /home/nick/etc/gconf/schemas/system_smb .schemas -rw-r--r--
1 root root 22K 05-03 03:04 /home/nick/etc/gconf/schemas/desktop_gnome_thumbnailers .schemas -rw-r--r--
1 root root 17K 05-03 03:04 /home/nick/etc/gconf/schemas/apps_gnome_settings_daemon_default_editor .schemas |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#使用which命令查找ls命令的完整路径 [root@lovelace
scripts] #
which ls alias ls = 'ls
--color=tty' /bin/ls #使用ldd命令查看ls所依赖的库文件(这里需要用到ls的完整路径) [root@lovelace
scripts] #
ldd /bin/ls linux-gate.so.1
=> (0x00cf8000) librt.so.1
=> /lib/librt .so.1
(0x00d8d000) libacl.so.1
=> /lib/libacl .so.1
(0x00d62000) libselinux.so.1
=> /lib/libselinux .so.1
(0x00de0000) libc.so.6
=> /lib/libc .so.6
(0x00110000) libpthread.so.0
=> /lib/libpthread .so.0
(0x00d71000) /lib/ld-linux .so.2
(0x00baf000) libattr.so.1
=> /lib/libattr .so.1
(0x003a9000) libdl.so.2
=> /lib/libdl .so.2
(0x00d55000) libsepol.so.1
=> /lib/libsepol .so.1
(0x00d98000) |
1
2
3
4
5
6
7
8
|
#使用whereis查看命令的完整路径和相应的man文件 [root@lovelace
scripts] #
whereis ls ls : /bin/ls /usr/share/man/man1/ls .1.gz /usr/share/man/man1p/ls .1p.gz #man
查看对应的文件 [root@lovelace
scripts] #
man 1 ls #man
查看对应的文件 [root@lovelace
scripts] # [root@lovelace
scripts] #
man 1p ls |
1
2
3
|
[root@lovelace
scripts] #
whatis ls ls (1)
- list directory contents ls (1p)
- list directory contents |
http://lovelace.blog.51cto.com/1028430/1212725