LinuxÓû§ÐÅÏ¢»ñÈ¡¼¼ÇÉ£º¼òÆÓ»ñÈ¡Ä¿½ñÓû§ÐÅÏ¢
LinuxÊÊÓü¼ÇÉ£ºÇáËÉ»ñÈ¡Ä¿½ñÓû§ÐÅÏ¢
ÔÚLinux²Ù×÷ϵͳÖУ¬¾³£»áÐèÒª»ñÈ¡Ä¿½ñÓû§µÄÐÅÏ¢£¬ÀýÈçÓû§Ãû¡¢Óû§ID¡¢ËùÊô×éµÈ¡£ÕâЩÐÅÏ¢¹ØÓÚϵͳÖÎÀíºÍµ÷ÊÔºÜÊÇÖ÷Òª¡£±¾ÎĽ«ÏÈÈݼ¸ÖÖÒªÁìÀ´»ñÈ¡Ä¿½ñÓû§µÄÐÅÏ¢£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
ʹÓÃwhoamiÏÂÁ
whoamiÏÂÁî¿ÉÒÔÓÃÀ´»ñÊÊÄ¿½ñÓû§µÄÓû§Ãû¡£ÕâÊÇÒ»¸ö¼òÆÓ¶ø³£ÓõÄÒªÁ죬ÊʺϿìËÙ»ñÈ¡Ä¿½ñÓû§µÄ»ù±¾ÐÅÏ¢¡£
$ whoami
µÇ¼ºó¸´ÖÆ
ʹÓÃidÏÂÁ
idÏÂÁî¿ÉÒÔÏÔʾĿ½ñÓû§µÄÓû§ID¡¢ËùÊô×éIDµÈÏêϸÐÅÏ¢¡£ÒÔÏÂÊÇ»ñÈ¡Ä¿½ñÓû§ÏêϸÐÅÏ¢µÄʾÀý£º
$ id
µÇ¼ºó¸´ÖÆ
ʹÓÃecho $USERÇéÐαäÁ¿£º
LinuxÇéÐÎÖÐ$USERÇéÐαäÁ¿´æ´¢ÁËÄ¿½ñÓû§µÄÓû§Ãû¡£¿ÉÒÔͨ¹ýechoÏÂÁîÀ´´òÓ¡³öÄ¿½ñÓû§Ãû£º
$ echo $USER
µÇ¼ºó¸´ÖÆ
ʹÓÃwÏÂÁ
wÏÂÁî¿ÉÒÔÏÔʾĿ½ñµÇ¼ϵͳµÄÓû§ÐÅÏ¢£¬°üÀ¨Óû§Ãû¡¢Öնˡ¢µÇ¼ʱ¼äµÈ¡£ÒÔÏÂÊÇÉó²éÄ¿½ñÓû§ÐÅÏ¢µÄʾÀý£º
$ w
µÇ¼ºó¸´ÖÆ
ʹÓÃlognameÏÂÁ
lognameÏÂÁîÓÃÓÚ»ñÈ¡Ä¿½ñµÇÈÎÃü»§µÄµÇ¼Ãû£¬ÓëwhoamiÀàËÆ¡£ÒÔÏÂÊÇ»ñÈ¡Ä¿½ñµÇÈÎÃü»§ÃûµÄʾÀý£º
$ logname
µÇ¼ºó¸´ÖÆ
ͨ¹ýÒÔÉϼ¸ÖÖÒªÁ죬ÎÒÃÇ¿ÉÒÔÇáËÉ»ñÈ¡Ä¿½ñÓû§µÄÐÅÏ¢¡£ÕâЩҪÁìÔÚÒ»Ñùƽ³£ÏµÍ³ÖÎÀíºÍShell¾ç±¾¿ª·¢Öо³£»áÓõ½£¬Äܹ»×ÊÖúÎÒÃǸüºÃµØÏàʶĿ½ñϵͳÇéÐκÍÓû§È¨ÏÞ¡£
Ï£Íû±¾ÎÄÌṩµÄÒªÁìÄܹ»×ÊÖúµ½¶ÁÕߣ¬Èø÷ÈËÔÚLinuxϵͳÖиüÎÞаµØ»ñÈ¡Ä¿½ñÓû§ÐÅÏ¢¡£×£¸÷ÈËÔÚLinuxµÄÌìÏÂÀï̽Ë÷¼¼ÇÉ£¬ÌáÉýÊÂÇéЧÂÊ£¡
ÒÔÉϾÍÊDZ¾ÎÄÄÚÈÝ£¬Ï£Íû¶ÔÄúÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇLinuxÓû§ÐÅÏ¢»ñÈ¡¼¼ÇÉ£º¼òÆÓ»ñÈ¡Ä¿½ñÓû§ÐÅÏ¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡