¿ìËÙ»ñÈ¡LinuxÎļþµÄÍêÕû·¾¶
ÔÚLinuxϵͳÖУ¬ÓÐʱ¼äÎÒÃÇÐèÒª¿ìËÙ»ñÈ¡ÎļþµÄÍêÕû·¾¶À´Àû±ã¾ÙÐвÙ×÷»òÕß²éÕÒÎļþ¡£»ñÈ¡LinuxÎļþµÄÍêÕû·¾¶¿ÉÒÔͨ¹ýʹÓÃһЩ¼òÆÓµÄÏÂÁîÀ´ÊµÏÖ¡£±¾ÎĽ«ÏÈÈÝÔõÑù¿ìËÙ»ñÈ¡LinuxÎļþµÄÍêÕû·¾¶£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
ʹÓÃpwdÏÂÁî»ñÈ¡Ä¿½ñÊÂÇéĿ¼
pwdÏÂÁîÓÃÓÚÏÔʾĿ½ñÊÂÇéĿ¼µÄÍêÕû·¾¶¡£¿ÉÒÔͨ¹ýÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁîÀ´»ñÈ¡Ä¿½ñÊÂÇéĿ¼µÄÍêÕû·¾¶£º
pwd
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÉÏÊöÏÂÁîºó£¬Öն˽«»áÏÔʾĿ½ñÊÂÇéĿ¼µÄÍêÕû·¾¶£¬Èç/home/user/Documents¡£
ʹÓÃrealpathÏÂÁî»ñÈ¡ÎļþµÄÍêÕû·¾¶
realpathÏÂÁîÓÃÓÚ»ñÈ¡Ö¸¶¨ÎļþµÄÍêÕû·¾¶¡£¿ÉÒÔͨ¹ýÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁîÀ´»ñÈ¡Ö¸¶¨ÎļþµÄÍêÕû·¾¶£º
realpath ÎļþÃû
µÇ¼ºó¸´ÖÆ
ÀýÈ磬Ҫ»ñÈ¡Îļþexample.txtµÄÍêÕû·¾¶£¬¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁ
realpath example.txt
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÏÂÁîºó£¬Öն˽«Êä³öexample.txtµÄÍêÕû·¾¶£¬Èç/home/user/Documents/example.txt¡£
ʹÓÃreadlinkÏÂÁî»ñÈ¡Á´½ÓÎļþµÄÍêÕû·¾¶
ÈôÊÇÎļþÊÇÒ»¸ö·ûºÅÁ´½ÓÎļþ£¬¿ÉÒÔʹÓÃreadlinkÏÂÁîÀ´»ñÈ¡ÆäÄ¿µÄÎļþµÄÍêÕû·¾¶¡£¿ÉÒÔͨ¹ýÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁîÀ´»ñÈ¡·ûºÅÁ´½ÓÎļþµÄÄ¿µÄÎļþµÄÍêÕû·¾¶£º
readlink ·ûºÅÁ´½ÓÎļþ
µÇ¼ºó¸´ÖÆ
ÀýÈ磬Ҫ»ñÈ¡·ûºÅÁ´½ÓÎļþlink.txtËùÖ¸ÏòµÄÄ¿µÄÎļþµÄÍêÕû·¾¶£¬¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁ
readlink link.txt
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÏÂÁîºó£¬Öն˽«Êä³ö·ûºÅÁ´½ÓÎļþlink.txtËùÖ¸ÏòµÄÄ¿µÄÎļþµÄÍêÕû·¾¶¡£
ʹÓÃfindÏÂÁî²éÕÒÎļþ²¢»ñÈ¡ÍêÕû·¾¶
findÏÂÁî²»µ«¿ÉÒÔÓÃÀ´²éÕÒÎļþ£¬»¹¿ÉÒÔÀû±ãµØ»ñÈ¡ÎļþµÄÍêÕû·¾¶¡£¿ÉÒÔͨ¹ýÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁîÀ´²éÕÒÎļþ²¢»ñÈ¡ÆäÍêÕû·¾¶£º
find ÆðʼĿ¼ -name ÎļþÃû
µÇ¼ºó¸´ÖÆ
ÀýÈ磬Ҫ²éÕÒËùÖøÃûΪexample.txtµÄÎļþ²¢»ñÈ¡ËüÃǵÄÍêÕû·¾¶£¬¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁ
find /home/user/Documents -name example.txt
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÏÂÁîºó£¬Öն˽«Êä³öËùÖøÃûΪexample.txtµÄÎļþµÄÍêÕû·¾¶¡£
×ܽá
ÒÔÉÏÊǼ¸ÖÖ¿ìËÙ»ñÈ¡LinuxÎļþÍêÕû·¾¶µÄÒªÁ죬¿ÉÒÔƾ֤ÏêϸÐèÇóÑ¡ÔñÊʺϵÄÒªÁ졣ͨ¹ýpwd¡¢realpath¡¢readlinkºÍfindµÈÏÂÁ¿ÉÒÔÀû±ãµØ»ñÈ¡ÎļþµÄÍêÕû·¾¶£¬Ìá¸ßÊÂÇéЧÂÊ¡£Ï£ÍûÒÔÉÏÄÚÈÝÄܹ»×ÊÖú¶ÁÕß¿ìËÙ»ñÈ¡LinuxÎļþµÄÍêÕû·¾¶£¬²¢Ë³ËìÍê³ÉÏìÓ¦²Ù×÷¡£
ÒÔÉϾÍÊÇ¿ìËÙ»ñÈ¡LinuxÎļþµÄÍêÕû·¾¶µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡