LinuxÎļþ²éÕÒÃüÁîfind,xargsÏêÊö
À´×Ô£ºhttp://www.linuxsir.org/main/?q=node/137#1.2
ÕªÒª£º ±¾ÎÄÊÇfind ÃüÁîµÄÏêϸ˵Ã÷£¬¿É¹óµÄÊÇÕë¶Ô²ÎÊý¾ÙÁ˺ܶàµÄʵÀý£¬´óÁ¿µÄÀýÖ¤£¬ÈóõѧÕ߸üΪÈÝÒ×Àí½â£»±¾ÎÄÊÇzhyflyÐÖÌùÔÚÂÛ̳ÖУ»ÎÒ¶Ô±¾ÎĽøÐÐÁËÔÙ´ÎÕûÀí£¬Îª·½±ã´ó¼ÒÔĶÁ£»
Ŀ¼
°æȨÉùÃ÷
Ç°ÑÔ£º¹ØÓÚfindÃüÁî
Ò»¡¢find ÃüÁî¸ñʽ
1¡¢findÃüÁîµÄÒ»°ãÐÎʽΪ£»
2¡¢findÃüÁîµÄ²ÎÊý£»
3¡¢findÃüÁîÑ¡Ï
4¡¢Ê¹ÓÃexec»òokÀ´Ö´ÐÐshellÃüÁ
¶þ¡¢findÃüÁîµÄÀý×Ó£»
1¡¢²éÕÒµ±Ç°Óû§Ö÷Ŀ¼ÏµÄËùÓÐÎļþ£»
2¡¢ÎªÁËÔÚµ±Ç°Ä¿Â¼ÖÐÎļþÊôÖ÷¾ßÓжÁ¡¢Ð´È¨ÏÞ£¬²¢ÇÒÎļþËùÊô×éµÄÓû§ºÍÆäËûÓû§¾ßÓжÁȨÏÞµÄÎļþ£»
3¡¢ÎªÁ˲éÕÒϵͳÖÐËùÓÐÎļþ³¤¶ÈΪ0µÄÆÕͨÎļþ£¬²¢ÁгöËüÃǵÄÍêÕû·¾¶£»
4¡¢²éÕÒ/var/logsĿ¼Öиü¸Äʱ¼äÔÚ7ÈÕÒÔÇ°µÄÆÕͨÎļþ£¬²¢ÔÚɾ³ý֮ǰѯÎÊËüÃÇ£»
5¡¢ÎªÁ˲éÕÒϵͳÖÐËùÓÐÊôÓÚroot×éµÄÎļþ£»
6¡¢findÃüÁɾ³ýµ±Ä¿Â¼ÖзÃÎÊʱ¼äÔÚ7ÈÕÒÔÀ´¡¢º¬ÓÐÊý×Öºó׺µÄadmin.logÎļþ
7¡¢ÎªÁ˲éÕÒµ±Ç°ÎļþϵͳÖеÄËùÓÐĿ¼²¢ÅÅÐò£»
8¡¢ÎªÁ˲éÕÒϵͳÖÐËùÓеÄrmt´Å´øÉ豸£»
Èý¡¢xargs
ËÄ¡¢find ÃüÁîµÄ²ÎÊý£»
1¡¢Ê¹ÓÃnameÑ¡Ïî
2¡¢ÓÃpermÑ¡Ïî
3¡¢ºöÂÔij¸öĿ¼
4¡¢Ê¹ÓÃfind²éÕÒÎļþµÄʱºòÔõô±Ü¿ªÄ³¸öÎļþĿ¼
5¡¢Ê¹ÓÃuserºÍnouserÑ¡Ïî
6¡¢Ê¹ÓÃgroupºÍnogroupÑ¡Ïî
7¡¢°´ÕÕ¸ü¸Äʱ¼ä»ò·ÃÎÊʱ¼äµÈ²éÕÒÎļþ
8¡¢²éÕÒ±Èij¸öÎļþлò¾ÉµÄÎļþ
9¡¢Ê¹ÓÃtypeÑ¡Ïî
10¡¢Ê¹ÓÃsizeÑ¡Ïî
11¡¢Ê¹ÓÃdepthÑ¡Ïî
12¡¢Ê¹ÓÃmountÑ¡Ïî
Îå¡¢¹ØÓÚ±¾ÎÄ
Áù¡¢Ïà¹ØÎĵµ
+++++++++++++++++++++++++++++++++++++++++++++++++
ÕýÎÄ
+++++++++++++++++++++++++++++++++++++++++++++++++
°æȨÉùÃ÷
±¾ÎÄÊÇzhyflyÐÖÌùÔÚLinuxSir.Org µÄÒ»¸öÌû×Ó¶øÕûÀí³öÀ´µÄ£¬Èç¹ûÄú¶Ô°æȨÓÐÒÉÎÊ£¬ÇëÔÚ±¾ÌûºóÃæ¸úÌû¡£Ð»Ð»£»±¾ÎĵÄHTML°æ±¾Óɱ±ÄÏÄϱ±ÕûÀí£»ÐÞ¸ÄÁËÕûƪÎĵµµÄÈ«½Ç¼°ËµÃ÷ÎÄ×ÖÖеĵ¥´ÊÖÐÿ¸ö×Öĸ¿Õ¸ñµÄÎÊÌ⣻Ϊ±êÌâ¼ÓÁ˱àºÅ£¬·½±ã´ó¼ÒÔĶÁ£»
Ç°ÑÔ£º¹ØÓÚfindÃüÁî
ÓÉÓÚfind¾ßÓÐÇ¿´óµÄ¹¦ÄÜ£¬ËùÒÔËüµÄÑ¡ÏîÒ²ºÜ¶à£¬ÆäÖд󲿷ÖÑ¡ÏֵµÃÎÒÃÇ»¨Ê±¼äÀ´Á˽âһϡ£¼´Ê¹ÏµÍ³Öк¬ÓÐÍøÂçÎļþϵͳ( NFS)£¬findÃüÁîÔÚ¸ÃÎļþϵͳÖÐͬÑùÓÐЧ£¬Ö»Äã¾ßÓÐÏàÓ¦µÄȨÏÞ¡£
ÔÚÔËÐÐÒ»¸ö·Ç³£ÏûºÄ×ÊÔ´µÄfindÃüÁîʱ£¬ºÜ¶àÈ˶¼ÇãÏòÓÚ°ÑËü·ÅÔÚºǫִ́ÐУ¬ÒòΪ±éÀúÒ»¸ö´óµÄÎļþϵͳ¿ÉÄܻỨ·ÑºÜ³¤µÄʱ¼ä(ÕâÀïÊÇÖ¸30G×Ö½ÚÒÔÉϵÄÎļþϵͳ)¡£
Ò»¡¢find ÃüÁî¸ñʽ
1¡¢findÃüÁîµÄÒ»°ãÐÎʽΪ£»
find pathname -options [-print -exec -ok ...
Ïà¹ØÎĵµ£º
ΪʲôLinux²»ÄÜÆÕ¼°£¬ÏàÐÅÕâ¸öÎÊÌâʹÓùýLinuxµÄÓû§¶àÉٵĶ¼Äܸоõµ½¡£µ±È»ÔÚÆÕ¼°Õâ·½Ãæ˵£¬ÎÒÃÇÒªÒÔ´óÖڵĹÛÄîÀ´¿´£¬ËùνµÄ´óÖÚ¾ÍÊÇÄÇЩÆÕͨµÄÓû§£¬·ÇרҵµÄÈËÊ¿¡£È«ÇòʹÓõçÄÔµÄ80%µÄÈËȺ»¹ÊÇÆÕͨÓû§£¨ÕâÀïµÄ80%ÊǸù¾ÝÈí¼þ²úÒµµÄ¹æÔòÀ´Ëµ£¬¾ßÌå¶àÉÙÎÒÒ²²»ÖªµÀ£¬O(∩_∩)O~£©£¬ÆÕͨÓû§ÐèҪʲô£¿ËûÃÇÐèÒ ......
ÕýÔò±í´ïʽ Ö®Ôª×Ö·ûÀíÂÛƪ
1.Ôª×Ö·û
\ ÒýÓ÷û£¬ÓÃÓÚ¹ýÂ˵ôÔª×Ö·ûµÄÆ¥Å䣬½«Ëüµ±×÷Ò»¸öÆÕͨµÄ×Ö·ûÀ´½øÐÐÆ¥Å䣨°ü
À¨ÏÂÃ潫³öÏÖµÄËùÓÐÔª×Ö·û£©
. Æ¥ÅäÈκε¥¸ö×Ö·û
? Æ¥Åä0»ò1¸öÔÚËüÇ°Ã棬¼´"?"ºÅÇ°ÃæµÄ×Ö·û
* Æ¥Åä0»òÈÎÒâ¸öÔÚËüÇ°Ã棬¼´"*"ºÅÇ° ......
°æ±¾10.2
ÔÚ9iÏÂdbstart´æÔÚÒ»bug£ºdbstartÆô¶¯Ê±ÔÚ$ORACLE_HOME/dbsÏÂÑ°ÕÒinitSID.ora£¬ÊÂʵÉÏÔÚ¸ÃĿ¼Ï²»´æÔÚÕâ¸öpfile£¬ÔÚ9i ÒѾʹÓÃÁËspfile£¬ËùÒÔÒªÏëÕý³£Í¨¹ýdbstartÆô¶¯db£¬ÐèÒªÔÚĿ¼$ORACLE_HOME/dbsÏ´´½¨Ò»¸öinitSID.ORAÎļþ£¬10gÖÐÎÒ·¢ÏÖÐÞÕýÁËÕâÒ»ÎÊÌâ¡£²»¹ý10gÖÐdbstartÔÚ×Ô¶¯Æô¶¯listenerʱ´æÔÚÒ»ÎÊÌ⣠......
²é¿´µ±Ç°Ä¿Â¼ÏÂÎļþµÄ¸öÊý
ls -l | grep "^-" | wc -l
²é¿´µ±Ç°Ä¿Â¼ÏÂÎļþµÄ¸öÊý£¬°üÀ¨×ÓĿ¼ÀïµÄ¡£
ls -lR| grep "^-" | wc -l
²é¿´Ä³Ä¿Â¼ÏÂÎļþ¼Ð£¨Ä¿Â¼£©µÄ¸öÊý£¬°üÀ¨×ÓĿ¼ÀïµÄ¡£
ls -lR| grep "^d" | wc -l
¼òҪ˵Ã÷£º
ls -l
³¤ÁбíÊä³ö¸ÃĿ¼ÏÂÎļþÐÅÏ¢(×¢ÒâÕâÀïµÄÎļþ£¬²»Í¬ÓÚÒ»°ãµÄÎļþ£¬¿ÉÄÜÊÇÄ ......