ºìÁªLinuxÃÅ»§
Linux°ïÖú

RHCEµÚÊ®Îå½²£º¿ÉÖ´ÐÐÎļþµÄËÑË÷

·¢²¼Ê±¼ä:2010-12-07 10:46:42À´Ô´:ºìÁª×÷Õß:linuxcui
which
whichÓÃÓÚÏÔʾ²éÕÒ¿ÉÖ´ÐÐÎļþµÄÍêȫ·¾¶,ÀýÈç:
[kevinz@stationXX kevinz] $which ls

alias
ls = ¡®ls
--color=tty ¡®


/bin/ls
which Ê×ÏȲéÕÒϵͳÖбðÃû¼Ç¼(alias),È»ºó²éÕÒϵͳ·¾¶£¨$PATH)¡£Ò»°ãÎÒÃDz»°Ñµ±Ç°Ä¿Â¼¡± . ¡°¼ÓÈëϵͳ·¾¶£¬ËùÒÔµ±Ç°Â·¾¶ÖеÄÎļþÃüÁî²»ÔÚÏÔʾÖС£
whereis
whereisÓÃÓÚÏÔʾ²éÕÒÎļþµÄ·¾¶¡¢¸ÃÎļþµÄ°ïÖúÎļþ·¾¶¡¢¸ÃÎļþµÄÏà¹ØÔ­³ÌÐòµÄ·¾¶£¬ÀýÈ磺
[kevinz@stationXX kevinz] $whereis chdir
mkdir :
/bin/mkdir
/usr/share/man/man1/mkdir.1.gz
/usr/share/man/man2/mkdir.2.gz
[kevinz@stationXX kevinz] $whereis fstab
fstab:
/etc/fstab
/etc/fstab.REVOKE
/usr/include/fstab.sh
/usr/share/man/man5/fstab.5.gz
/usr/share/man/man5/fstab.5.gz
slocate
Ê×ÏÈlocateÊÇslocateµÄÒ»¸ö·ûºÅÁ´½Ó,ÎÒÃÇ¿ÉÒÔÕâÑù²é¿´£º
[kevinz@stationXX kevinz] $ls -l /usr/bin/locate
lrwxrwxrwx
root
slocate
7
Jul
22
23:03
/usr/bin/locate -> slocate
slocateµÄÊý¾Ý¿âÓÉÊØ»¤½ø³Ì£¨crond )ÔÚÿÌìÔçÉÏ4:02×Ô¶¯¸üÐÂ,Ò²¾ÍÊÇ˵Èç¹ûÄãÏÖÔÚ¶ÔϵͳÎļþ×÷µÄÐ޸IJ»»áÔÚslocate·´Ó³³öÀ´¡£µ±È»ÎÒÃÇ¿ÉÒÔʹÓÃupdatedbÖ¸ÁîÀ´ÊÖ¶¯¸üÐÂÊý¾Ý¿â£¬²»¹ýÕâÊÇÐèÒª»¨·Ñʱ¼äµÄ¹¤×÷¡£


find
find ÊÇÎÒÃÇ×î³£ÓõÄÎļþ²éÕÒ¹¤¾ß£¬Ïà±Èslocat ¶øÑÔËüÓмÍʵÐÔµÄÓŵã,Óï·¨ÈçÏÂ:
find
[·¾¶]
[²ÎÊý]
[±í´ïʽ]
ÀýÈç:
[kevinz@stationXX kevinz] $ find
/usr/share/doc
-name
filename

ÃüÁî
·¾¶
²ÎÊý
±í´ïʽ
findµÄ³£ÓÃfind²ÎÊýÈçÏ£º
•-user£º¸ù¾ÝÎļþÓµÓÐÕßÑ°ÕÒÎļþ
•-group£º¸ù¾ÝÎļþËùÊô×éÑ°ÕÒÎļþ
•-name£º¸ù¾ÝÎļþÃûÑ°ÕÒÎļþ
•-perm£º¸ù¾ÝÎļþȨÏÞÑ°ÕÒÎļþ
•-size£º¸ù¾ÝÎļþ´óСѰÕÒÎļþ
•-type£º¸ù¾ÝÎļþÀàÐÍÑ°ÕÒÎļþ£¬²ÎÊý¶ÔÓ¦c¡¢b¡¢l¡¢f¡¢d
findµÄ±í´ïʽʹÓÃͨÅä·ûʱÐèҪʹÓá°¡±È¦½ç¡£ÀýÈ磺
[kevinz@stationXX kevinz] $ find . -name ¡°*.html¡±

find ²Ù×÷ÕÒµ½µÄÎļþ
µ±Ê¹ÓÃ-exec Ö¸Áîʱ£¬{} \ ; ±ØÐëһͬÌí¼Ó
ÀýÈ磺
[kevinz@stationXX kevinz] $find . -exec ls
{} \;
µ±²Ù×÷Ö¸ÁîÐèÒªÕ÷ѯÓû§Òâ¼û£¬¿ÉÒÔÌí¼Ó-ok×Ô¶¯»Ø´ð¡®ÊÇ¡¯
ÀýÈ磺
[kevinz@stationXX kevinz] $find . -ok rm {} \;
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ