Éó¼Æ¸ú×ÙLinuxµÄÒì³£»î¶¯
Éó¼Æ¸ú×ÙLinuxµÄÒì³£»î¶¯
Zhaoke, 2007-01-29
һЩÒì³£Óû§ÊÔͼÒÆȥϵͳÉϵÄËùÓл¼Ç¼(±ÈÈç ~/.bash_history), ²»¹ýÎÒÃÇ¿ÉÒÔʹÓÃרÃŵŤ¾ßÀ´¼àÊÓËùÓÐÓû§Ö´ÐеÄÃüÁî. ÍƼöÄãʹÓýø³Ì¼ÇÕÊÀ´¼Ç¼Óû§µÄ»î¶¯, Äã¿ÉÒÔͨ¹ý½ø³Ì¼ÇÕʲ鿴ÿһ¸öÓû§Ö´ÐеÄÃüÁî, °üÀ¨CPUʱ¼äºÍÄÚ´æÕ¼ÓÃ.
psacct³ÌÐòÌṩÁ˼¸¸ö½ø³Ì»î¶¯¼àÊÓ¹¤¾ß: ac, lastcomm, acctonºÍsa.
.acÃüÁîÏÔʾÓû§Á¬½Óʱ¼äµÄͳ¼Æ.
.lastcommÃüÁîÏÔʾϵͳִÐеÄÃüÁî.
.acctonÃüÁîÓÃÓÚ´ò¿ª»ò¹Ø±Õ½ø³Ì¼ÇÕʹ¦ÄÜ.
.saÃüÁîͳ¼Æϵͳ½ø³Ì¼ÇÕʵÄÇé¿ö.
1). °²×°psacct»òacctÈí¼þ°ü
Èç¹ûÄãʹÓÃRHEL, ʹÓÃup2dateÃüÁî:
# up2date psacct
Èç¹ûÄãʹÓÃCentOS/Fedora Core Linux, ʹÓÃyumÃüÁî:
$ sudo apt-get install acct
»ò
# apt-get install acct
2). Æô¶¯psacct/acct·þÎñ
ÔÚUbuntu/Debian LinuxϵͳÉÏ, pacct¿ÉÒÔ×Ô¶¯Æô¶¯.(°²×°°ü»áÔÚϵͳÉÏ´´½¨Ò»¸ö/var/account/pacctÎļþ). µ«ÊÇÔÚRed Hat/Fedora Core/Cent OS, ÄãÐèÒªÊÖ¶¯Æô¶¯psacct·þÎñ. ÇÃÈëÏÂÃæÁ½¸öÃüÁî´´½¨/var/account/pacctÎļþºÍÆô¶¯pacct·þÎñ:
# chkconfig psacct on
# /etc/init.d/psacct start
Èç¹ûÄãʹÓÃSuse Linux, ·þÎñµÄÃû³ÆΪacct, ÇÃÈëÏÂÃæµÄÃüÁî:
# chkconfig acct on
# /etc/init.d/acct start
ÏÖÔÚÎÒÃÇ¿ÉÒÔÁ˽âÈçºÎÀûÓÃÕâЩ¹¤¾ßÀ´¼àÊÓÓû§µÄÃüÁîºÍʱ¼ä.
3). ÏÔʾÓû§Á¬Ïßʱ¼äµÄͳ¼ÆÐÅÏ¢
ÃüÁî¿ÉÒÔ¸ù¾ÝµÇ½Êý/Í˳öÊýÔÚÆÁÄ»ÉÏ´òÓ¡³öÓû§µÄÁ¬Ïßʱ¼ä(µ¥Î»ÎªÐ¡Ê±). ×ܼÆʱ¼äÒ²¿ÉÒÔ´òÓ¡³öÀ´. Èç¹ûÄãÖ´ÐÐûÓÐÈκβÎÊýµÄacÃüÁî, ÆÁÄ»½«»áÏÔʾ×ܼƵÄÁ¬Ïßʱ¼ä:
$ ac
Êä³ö:
total 95.08
ÏÔʾÿһÌìµÄÁ¬Ïßͳ¼Æʱ¼ä:
$ ac -d
Êä³ö:
Nov 1 total 8.65
Nov 2 total 5.70
Nov 3 total 13.43
Nov 4 total 6.24
Nov 5 total 10.70
Nov 6 total 6.70
Nov 7 total 10.30
…..
..
…
Nov 12 total 3.42
Nov 13 total 4.55
Today total 0.52
ÏÔʾÿһ¸öÓû§µÄ×ܼÆÁ¬Ïßʱ¼äºÍËùÓÐÓû§×ܼÆÁ¬Ïßʱ¼ä:
$ ac -p
Êä³ö:
vivek 87.49
root 7.63
total 95.11
4). ²éÕÒÓû§¹ýÈ¥Ö´ÐеÄÃüÁî
Äã¿ÉÒÔʹÓÃlastcommÃüÁî´òÓ¡³öÓû§¹ýÈ¥Ö´ÐеÄÃüÁî. ÄãÒ²¿ÉÒÔͨ¹ýÓû§Ãû, ttyÃû»òÃüÁîÃûÀ´ËÑË÷ÒÔÍùÖ´ÐеÄÃüÁî.
±ÈÈçÏÔʾvivekÓû§¹ýÈ¥Ö´ÐеÄÃüÁî:
$ lastcomm vivek
Êä³ö:
[code]
userhelper S X vivek pts/0 0.00 secs Mon Nov 13 23:58
userhelper S vivek pts/0 0.00 secs Mon Nov 13 23:45
rpmq vive
Ïà¹ØÎĵµ£º
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
LinuxµÄÍøÂçÅäÖÃ
Redhat LinuxµÄÍøÂçÅäÖ㬻ù±¾ÉÏÊÇͨ¹ýÐ޸ļ¸¸öÅäÖÃÎļþÀ´ÊµÏֵģ¬ËäȻҲ¿ÉÒÔÓÃifconfigÀ´ÉèÖÃIP£¬ÓÃrouteÀ´ÅäÖÃĬÈÏÍø¹Ø£¬ÓÃhostnameÀ´ÅäÖÃÖ÷»úÃû£¬µ«ÊÇÖØÆôºó»á¶ªÊ§¡£
Ïà¹ØµÄÅäÖÃÎļþ
/ect/hosts ÅäÖÃÖ÷»úÃûºÍIPµØÖ·µÄ¶ÔÓ¦
/etc/sysconfig/network ÅäÖÃÖ ......
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ (kernel) ÔÚÄÚ
/boot/grub/menu.lst &n ......
·þÎñÆ÷ͻȻ³öÏÖ¹«ÍøÍøÂ粻ͨ¡£»¹ºÃÓÐÅäÁ½¸öIP£¬Ò»¹«Íø£¬Ò»ÄÚÍø£¬ÄÚÍø¿Éͨ£¬Í¨¹ýÄÚÍøÁ¬½Óµ½·þÎñÆ÷ÉÏ ¡£²é¿´ÈÕÖ¾£¬dmesg£¬·¢ÏÖÓÐÕâÑùÒ»Ìõ£º
Sep 9 14:34:36 slave kernel: NETDEV WATCHDOG: eth0: transmit timed out
/etc/init.d/network restart ÍøÂç·þÎñÖØÆôһϣ¬»Ö¸´Õý³£¡£
µ½google²éÕÒ×ÊÁÏ£¬·¢ÏÖÒ²ÓÐÒ»ÑùµÄÎÊ ......
linuxÏÂÍü¼ÇÁËmysqlµÄrootÓû§ÃÜÂë½â¾ö°ì·¨£º
¡¡¡¡Ò»¡¢ÒÔϵͳµÄrootÓû§£¨Ê²Ã´£¬ÄãµÄϵͳµÄrootÓû§ÃÜÂëÒ²ÍüÁË¡£ÄÇÖ»ºÃ¿´ÎÒÁíÍâһƪlinuxÏÂÍü¼ÇrootÓû§µÄ½â¾ö°ì·¨ÁËÏȽâ¾öÕâ¸öÎÊÌ⣩µÇ½ϵͳ£¬½øÈëÖÕ¶Ë
¡¡¡¡[root@localhost /]#
¡¡¡¡¶þ¡¢É±µômysql½ø³Ì
¡¡¡¡·½·¨1¡¢[root@localhost /]#killall mysqld
¡¡¡¡·½·¨2¡ ......