ÏàʶLinuxÖеÄÄ¿½ñ·¾¶ÏÔʾҪÁì
ÔÚLinux²Ù×÷ϵͳÖУ¬Ä¿½ñ·¾¶Ö¸µÄÊÇÓû§Ä¿½ñËù´¦µÄÊÂÇéĿ¼¡£ÏàʶĿ½ñ·¾¶¹ØÓÚÓû§ÔÚÏÂÁîÐÐÇéÐÎÖеIJÙ×÷ºÜÊÇÖ÷Òª£¬ÓÉÓÚÓû§ÐèÒªÖªµÀ×Ô¼ºÔÚÄĸöĿ¼Ï£¬ÒÔ±ãÄܹ»×¼È·µØ¶¨Î»ºÍ²Ù×÷Îļþ¡£±¾ÎĽ«ÏÈÈݼ¸ÖÖÔÚLinuxϵͳÖÐÏÔʾĿ½ñ·¾¶µÄÒªÁ죬²¢¸½ÉÏÏêϸµÄ´úÂëʾÀý¡£
ÒªÁìÒ»£ºÊ¹ÓÃpwdÏÂÁî
pwd ÏÂÁîÊÇ Linux ϵͳÖÐ×î¼òÆÓÖ±½ÓµÄÉó²éÄ¿½ñ·¾¶µÄÒªÁì¡£Óû§¿ÉÒÔÔÚÏÂÁîÐÐÖÐÖ±½ÓÊäÈë pwd£¬È»ºó°´Ï»سµ¼ü£¬ÏµÍ³»á·µ»ØÄ¿½ñËùÔÚ·¾¶µÄ¾ø¶Ô·¾¶¡£
ʾÀý´úÂëÈçÏ£º
pwd
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÒÔÉÏÏÂÁîºó£¬ÏµÍ³»áÏÔʾĿ½ñËùÔÚ·¾¶µÄ¾ø¶Ô·¾¶£¬ÀýÈç /home/user/documents¡£
ÒªÁì¶þ£ºÊ¹ÓÃechoÍŽáPWDÇéÐαäÁ¿
Linux ϵͳÖÐÓÐÒ»¸öÄÚÖõÄÇéÐαäÁ¿ PWD£¬ÉúÑÄ×ÅÄ¿½ñÓû§ËùÔÚµÄĿ¼·¾¶¡£Óû§¿ÉÒÔʹÓà echo ÏÂÁîÀ´ÏÔʾ¸ÃÇéÐαäÁ¿µÄÊýÖµ£¬¼´Ä¿½ñËùÔÚ·¾¶¡£
ʾÀý´úÂëÈçÏ£º
echo $PWD
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÒÔÉÏÏÂÁîºó£¬ÏµÍ³»áÊä³öÄ¿½ñËùÔÚ·¾¶µÄ¾ø¶Ô·¾¶£¬ÀýÈç /home/user/documents¡£
ÒªÁìÈý£ºÊ¹ÓÃcdÏÂÁîÍŽápwdÏÂÁî
Óû§Ò²¿ÉÒÔͨ¹ýһϵÁеÄÏÂÁî×éºÏÀ´Éó²éÄ¿½ñ·¾¶£¬ºÃ±ÈÏÈʹÓà cd ÏÂÁîÇл»µ½ËùÐè·¾¶£¬È»ºóÔÙʹÓà pwd ÏÂÁîÉó²éÄ¿½ñ·¾¶¡£
ʾÀý´úÂëÈçÏ£º
cd /home/user/documents pwd
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÒÔÉÏÁ½¸öÏÂÁîºó£¬ÏµÍ³»áÏÔʾÓû§ÒÑÇл»µ½ /home/user/documents Ŀ¼¡£
ÒªÁìËÄ£ºÊ¹ÓÃreadlinkÏÂÁî
readlink ÏÂÁî¿ÉÒÔÓÃÀ´Éó²é·ûºÅÁ´½ÓµÄ¾ø¶Ô·¾¶¡£ÈôÊÇÄ¿½ñ·¾¶Öб£´æ·ûºÅÁ´½ÓµÄÇéÐΣ¬¿ÉÒÔʹÓà readlink ÏÂÁîÍŽá pwd ÏÂÁîÀ´ÏÔʾĿ½ñ·¾¶µÄ¾ø¶Ô·¾¶¡£
ʾÀý´úÂëÈçÏ£º
readlink -f .
µÇ¼ºó¸´ÖÆ
Ö´ÐÐÒÔÉÏÏÂÁîºó£¬ÏµÍ³»áÏÔʾĿ½ñËùÔÚ·¾¶µÄ¾ø¶Ô·¾¶£¬ÀýÈç /home/user/documents¡£
ÒÔÉϼ´ÊǼ¸ÖÖÔÚ Linux ϵͳÖÐÏÔʾĿ½ñ·¾¶µÄÒªÁ죬Óû§¿ÉÒÔƾ֤×Ô¼ºµÄÏ°¹ßºÍÐèÇóÑ¡ÔñºÏÊʵķ½·¨À´Éó²éÄ¿½ñËùÔÚ·¾¶¡£Í¨¹ýÕÆÎÕÕâЩҪÁ죬Óû§¿ÉÒÔÔ½·¢Àû±ãµØÔÚÏÂÁîÐÐÇéÐÎÖвÙ×÷ÎļþºÍ¾ÙÐÐÆäËû²Ù×÷¡£
ÒÔÉϾÍÊÇÏàʶLinuxÖеÄÄ¿½ñ·¾¶ÏÔʾҪÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡