¼àÊÓÎïÀí×é¼þµÄ¸ß¼¶ Linux ÃüÁî
ת×Ô£ºhttp://www.oracle.com/technology/global/cn/pub/articles/advanced-linux-commands/part3.html
×÷ÕߣºArup Nanda
2009 Äê 1 Ô·¢±í
Ôڴ˲¿·ÖÖУ¬Á˽âÓÃÓÚ¼àÊÓÎïÀí×é¼þµÄ¸ß¼¶ Linux ÃüÁî
Linux ϵͳÓÉÈô¸ÉÖ÷ÒªÎïÀí×é¼þ×é³É£¬Èç CPU¡¢ÄÚ´æ¡¢Íø¿¨ºÍ´æ´¢É豸¡£ÒªÓÐЧµØ¹ÜÀí Linux »·¾³£¬ÄúÓ¦¸ÃÄܹ»ÒÔºÏÀíµÄ¾«¶È²âÁ¿ÕâЩ×ÊÔ´µÄ¸÷ÖÖÖ¸±ê — ÿ¸ö×é¼þ´¦Àí¶àÉÙ×ÊÔ´¡¢ÊÇ·ñ´æÔÚÆ¿¾±µÈ¡£
ÔÚ±¾ÏµÁеÄÆäËû²¿·ÖÖУ¬ÄúÒѾѧϰÁË´¦Óں꼶±ðµÄÓÃÓÚ²âÁ¿Ö¸±êµÄһЩÃüÁî¡£µ«Ôڴ˲¿·ÖÖУ¬Äú½«Á˽âרÃÅÓÃÓÚ¼àÊÓÎïÀí×é¼þµÄ¸ß¼¶ Linux ÃüÁî¡£¾ßÌå¶øÑÔ£¬Äú½«Á˽âÒÔÏÂÀà±ðµÄÃüÁ
×é¼þ
ÃüÁî
ÄÚ´æ
free¡¢vmstat¡¢mpstat¡¢iostat¡¢sar
CPU
vmstat¡¢mpstat¡¢iostat¡¢sar
I/O
vmstat¡¢mpstat¡¢iostat¡¢sar
½ø³Ì
ipcs¡¢ipcrm
ÕýÈçÄúËù¼û£¬Ä³Ð©ÃüÁî³öÏÖÔÚ¶à¸öÀà±ðÖС£ÕâÊÇÓÉÓÚÕâЩÃüÁî¿ÉÒÔÖ´ÐкܶàÈÎÎñ¡£Ä³Ð©ÃüÁî±È½ÏÊʺÏÓÚijЩ×é¼þ£¬ÀýÈç iostat ÊÊºÏ I/O£¬µ«ÊÇÄúÓ¦¸ÃÁ˽âËüÃǹ¤×÷µÄ²î±ð²¢Ê¹ÓÃÄú¸üÊìϤµÄÃüÁî¡£
ÔÚ¶àÊýÇé¿öÏ£¬µ¥¸öÃüÁî¿ÉÄܶÔÓÚÁ˽âʵ¼Ê·¢ÉúµÄÇé¿öûʲôÓá£Òª»ñÈ¡ËùÐèµÄÐÅÏ¢£¬ÄúÓ¦¸ÃÁ˽â¶à¸öÃüÁî¡£
free
Ò»¸ö³£¼ûµÄÎÊÌâÊÇ“ÎÒµÄÓ¦ÓóÌÐòºÍ¸÷ÖÖ·þÎñÆ÷¡¢Óû§ºÍϵͳ½ø³ÌÕýÔÚʹÓöàÉÙÄڴ棿”»òÕß“ÏÖÔÚÓжàÉÙÄÚ´æ¿ÉÓã¿”Èç¹ûÕýÔÚÔËÐеĽø³ÌʹÓõÄÄÚ´æ´óÓÚ¿ÉÓà RAM£¬ÔòÐèÒª½«ÕâЩ½ø³ÌÒƵ½½»»»Çø¡£Òò´Ë£¬Ò»¸ö²¹³äÎÊÌâÊÇ“ÕýÔÚʹÓöàÉÙ½»»»Çø¿Õ¼ä£¿”
free ÃüÁ»Ø´ðËùÓÐÕâЩÎÊÌâ¡£¶øÇÒ£¬Ò»¸ö·Ç³£ÓÐÓõÄÑ¡Ïî –m ¿ÉÒÔÏÔʾ¿ÉÓÃÄڴ棨ÒÔ MB Ϊµ¥Î»£©£º
# free -m
total used free shared buffers cached
Mem: 1772 1654 117 0 18 618
-/+ buffers/cache: 1017 754
Swap: 1983 1065 918
ÒÔÉÏÊä³öÏÔʾϵͳ¾ßÓÐ 1,772 MB µÄ RAM£¬ÒÑʹÓà 1,654 MB£¬»¹ÓÐ 117 MB ÄÚ´æ¿ÉÓᣵڶþÐÐÏÔʾÔÚÎïÀíÄÚ´æÖлº³åÇøºÍ»º´æ´óСµÄ¸ü¸Ä¡£µÚÈýÐÐÏÔʾ½»»»ÇøÀûÓÃÇé¿ö¡£
ÒªÒÔ KB »ò GB Ϊµ¥Î»ÏÔʾÒÔÉÏÄÚÈÝ£¬Ç뽫 -m Ñ¡Ïî·Ö±ðÌ滻Ϊ -k »ò -g¡£Ê¹Óà –b Ñ¡ÏÒÔ×Ö½ÚΪµ¥Î»¡£
# free -b
total used free shared buffers cached
Mem: 1858129920 1724039168 134090752 0 18640896 643194880
-/+ buffers/cache: 10622
Ïà¹ØÎĵµ£º
¹¦ÄÜÃèÊö£º
»ñȡһЩÎļþÏà¹ØµÄÐÅÏ¢¡£
Ó÷¨£º
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *path, struct stat *buf);
int fstat(int filedes, struct stat *buf);
int lstat(const char *path, struct stat *buf);
²ÎÊý£º
path£ºÎļþ ......
linux Ï ÓÃcÓïÑÔ´´½¨mysqlÊý¾Ý¿â±Ê¼Ç£¨¶þ£©
£££££££Á½¸ö¼òµ¥µÄÀý×Ó£¬¹©²Î¿¼±È½Ï
¡¶ÀýÒ»¡·
#include <stdio.h>
#include <stdlib.h>
#include
&q ......
±¾ÎÄÕª×Ô http://hi.baidu.com/yuhongchun027/blog/item/2ac559517ec1f5898c543002.html
LinuxÖÐtty pty pts ¸ÅÄîÇø±ð
»ù±¾¸ÅÄ
1> tty(ÖÕ¶ËÉ豸µÄͳ³Æ):
ttyÒ»´ÊÔ´ÓÚTeletypes£¬»òÕßteletypewriters£¬ÔÀ´Ö¸µÄÊǵ紫´ò×Ö»ú£¬ÊÇͨ¹ý´®ÐÐÏßÓôòÓ¡»ú¼üÅÌͨ¹ýÔĶÁºÍ·¢ËÍÐÅÏ¢µÄ¶«Î÷£¬ºóÀ´ÕⶫÎ÷±»¼üÅÌÓëÏÔʾÆ÷È¡´ú£¬Ëù ......
ÔÎĵØÖ·£ºhttp://wanping.blogbus.com/logs/28663569.html
1¡¢Ê±¼ä´Áת»»ÎªÕý³£ÏÔʾµÄʱ¼ä¸ñʽ
Freebsd
ϵͳÏ£º
ת»»ÃüÁîΪ£º
date -r 1112173761 »òÕߣºdate -r 1112173761 +"%Y-%m-%d %T %z"£¨ÄêÔÂÈյĸñʽ²»Ò»Ñù£©
Linux
ϵͳÏ£º
ת»»ÃüÁdate -d '1970-01-01 UTC 11121 ......
LinuxÄÚºË2.4°æÖÐÈ¥µôÁËÀÏ°æ±¾ÄÚºËÖеľ²Ì¬¶¨Ê±Æ÷»úÖÆ£¬¶øÖ»Áô϶¯Ì¬¶¨Ê±Æ÷¡£ÏàÓ¦µØÔÚtimer_bh()º¯ÊýÖÐÒ²²»ÔÙͨ¹ýrun_old_timers()º¯ÊýÀ´ÔËÐÐÀÏʽµÄ¾²Ì¬¶¨Ê±Æ÷¡£¶¯Ì¬¶¨Ê±Æ÷Ó뾲̬¶¨Ê±Æ÷Õâ¶þ¸ö¸ÅÄîÊÇÏà¶ÔÓÚLinuxÄں˶¨Ê±Æ÷»úÖƵĿÉÀ©Õ¹¹¦ÄܶøÑԵģ¬¶¯Ì¬¶¨Ê±Æ÷ÊÇÖ¸Äں˵Ķ¨Ê±Æ÷¶ÓÁÐÊÇ¿ÉÒÔ¶¯Ì¬±ä»¯µÄ£¬È»¶ø¾Í¶¨Ê±Æ÷±¾Éí¶ ......