Linuxϵͳϼì²éÓû§ÁбíµÄ°ì·¨
ÎÊÌ⣺LinuxϵͳÓû§Çåµ¥Éó²éÒªÁì¼°Ïêϸ²Ù×÷°ì·¨
Linux²Ù×÷ϵͳÊÇÒ»ÖÖ¿ªÔ´µÄ²Ù×÷ϵͳ£¬±»ÆÕ±éÓ¦ÓÃÓÚЧÀÍÆ÷ºÍСÎÒ˽È˵çÄÔµÈÁìÓò¡£ÔÚLinuxϵͳÖУ¬Óû§ÕË»§ÖÎÀíÊǺÜÊÇÖ÷ÒªµÄÒ»²¿·Ö£¬ÖÎÀíÔ±ÐèҪʱ³£Éó²éϵͳÖеÄÓû§Çåµ¥ÒÔ¼°ÆäÏà¹ØÐÅÏ¢¡£±¾ÎĽ«ÏÈÈÝÔÚLinuxϵͳÖÐÉó²éÓû§Çåµ¥µÄÏêϸ°ì·¨£¬Í¬Ê±ÌṩÏà¹Ø´úÂëʾÀý¡£
Ò»¡¢Éó²éÓû§Çåµ¥µÄ»ù±¾·½·¨
ÔÚLinuxϵͳÖУ¬¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖ³£Ó÷½·¨Éó²éÓû§Çåµ¥£º
ʹÓÃÏÂÁîÐй¤¾ßÉó²é
ÔÚLinuxϵͳÖУ¬¿ÉÒÔͨ¹ýÏÂÁîÐй¤¾ßÉó²éÓû§Çåµ¥¡£³£ÓõÄÏÂÁî°üÀ¨cat¡¢less¡¢grepµÈ¡£Í¨¹ý¶ÁȡϵͳÎļþ£¬¿ÉÒÔ»ñÈ¡Óû§µÄ»ù±¾ÐÅÏ¢¡£
ʹÓÃϵͳÖÎÀí¹¤¾ßÉó²é
Linuxϵͳ»¹ÌṩÁËһЩϵͳÖÎÀí¹¤¾ß£¬¿ÉÒÔͨ¹ýÕâЩ¹¤¾ß¸üÖ±¹ÛµØÉó²éÓû§Çåµ¥¡£ÀýÈç/etc/passwdÎļþ¾Í°üÀ¨ÁËϵͳÖÐËùÓÐÓû§µÄ»ù±¾ÐÅÏ¢¡£
½ÓÏÂÀ´ÎÒÃǽ«ÏÈÈÝÏêϸµÄ²Ù×÷°ì·¨£¬²¢Ìṩ´úÂëʾÀý¡£
¶þ¡¢Ïêϸ²Ù×÷°ì·¨¼°´úÂëʾÀý
ʹÓÃcatÏÂÁîÉó²éÓû§Çåµ¥
ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁ
cat /etc/passwd
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁî»áÏÔʾϵͳÖÐËùÓÐÓû§µÄ»ù±¾ÐÅÏ¢£¬°üÀ¨Óû§Ãû¡¢Óû§ID¡¢ËùÊô×éID¡¢¼ÒĿ¼·¾¶¡¢µÇ¼ShellµÈ¡£¿ÉÒÔͨ¹ý¹ÜµÀ·ûÍŽágrepÏÂÁîÀ´É¸Ñ¡¸ÐÐËȤµÄÐÅÏ¢£¬ÀýÈçÖ»ÏÔʾͨË×Óû§£º
cat /etc/passwd | grep '/bin/bash'
µÇ¼ºó¸´ÖÆ
ʹÓÃlessÏÂÁîÉó²éÓû§Çåµ¥
lessÏÂÁî¿ÉÒÔÈÃÓû§ÒÔ·ÖÒ³µÄÐÎʽÉó²éÎļþÄÚÈÝ£¬ÊʺÏÉó²é½Ï³¤µÄÓû§ÁÐ±í¡£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁ
less /etc/passwd
µÇ¼ºó¸´ÖÆ
ͨ¹ýlessÉó²éÓû§ÁÐ±í£¬¿ÉÒÔÀû±ãµØä¯ÀÀºÍ²éÕÒÐÅÏ¢¡£
ʹÓÃϵͳÖÎÀí¹¤¾ßÉó²éÓû§Çåµ¥
³ýÁËÏÂÁîÐй¤¾ß£¬Linuxϵͳ»¹ÌṩÁ˼¸¸öϵͳÖÎÀí¹¤¾ßÀ´Àû±ãµØÉó²éÓû§Çåµ¥¡£ÆäÖÐ/etc/passwdÎļþ°üÀ¨ÁËÓû§µÄ»ù±¾ÐÅÏ¢£¬¿ÉÒÔʹÓÃawkÏÂÁîÀ´É¸Ñ¡Ìض¨ÐÅÏ¢£º
awk -F: '{print $1}' /etc/passwd
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁî»áÁгöϵͳÖÐËùÓÐÓû§µÄÓû§Ãû¡£¿ÉÒÔƾ֤ÐèÒªÐÞ¸Äprint $1À´ÏÔʾÆäËû×ֶεÄÐÅÏ¢¡£
ÒÔÉϾÍÊÇÔÚLinuxϵͳÏÂÉó²éÓû§Çåµ¥µÄÒªÁì¼°Ïêϸ²Ù×÷°ì·¨¡£Óû§¿ÉÒÔƾ֤ÏÖʵÐèÇóÑ¡ÔñʹÓÃÏÂÁîÐй¤¾ß»òϵͳÖÎÀí¹¤¾ßÀ´Éó²éÓû§Çåµ¥£¬ÒÔ±ã¸üºÃµØÖÎÀíºÍά»¤ÏµÍ³ÖеÄÓû§ÕË»§¡£
ÒÔÉϾÍÊÇLinuxϵͳϼì²éÓû§ÁбíµÄ°ì·¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡