×ðÁú¿­Ê±

ÔõÑù¾ÙÐÐLinuxϵͳµÄÀú³ÌÖÎÀíºÍÐÔÄܼà²â

ÔõÑù¾ÙÐÐLinuxϵͳµÄÀú³ÌÖÎÀíºÍÐÔÄܼà²â

ÔÚLinuxϵͳÖÐ £¬Àú³ÌÖÎÀíºÍÐÔÄܼà²âÊǺÜÊÇÖ÷ÒªµÄʹÃü¡£ÔÚ±¾ÎÄÖÐ £¬ÎÒ½«·ÖÏíһЩ¹ØÓÚÔõÑù¾ÙÐÐLinuxϵͳµÄÀú³ÌÖÎÀíºÍÐÔÄܼà²âµÄ¼¼ÇÉ £¬Í¬Ê±ÌṩһЩÏêϸµÄ´úÂëʾÀý¡£

Ò»¡¢Àú³ÌÖÎÀí

Éó²éÀú³ÌÁбí

ʹÓÃpsÏÂÁî¿ÉÒÔÁгöÄ¿½ñϵͳÉÏËùÓеÄÀú³Ì £¬ÏÂÁîÃûÌÃÈçÏ£º

ps aux

µÇ¼ºó¸´ÖÆ

Õ⽫ÁгöËùÓÐÀú³ÌµÄÏêϸÐÅÏ¢ £¬°üÀ¨Àú³ÌID¡¢¸¸Àú³ÌID¡¢CPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÇéÐεÈ¡£

ɱËÀÀú³Ì

ʹÓÃkillÏÂÁî¿ÉÒÔÖÕÖ¹Ò»¸öÕýÔÚÔËÐеÄÀú³Ì £¬ÏÂÁîÃûÌÃÈçÏ£º

kill <Àú³ÌID>

µÇ¼ºó¸´ÖÆ

ÀýÈç £¬ÒªÖÕÖ¹IDΪ123µÄÀú³Ì £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

kill 123

µÇ¼ºó¸´ÖÆ

¼à¿ØÀú³Ì״̬

ͨ¹ýtopÏÂÁî¿ÉÒÔʵʱ¼à¿ØϵͳÉϵÄÀú³Ì״̬ £¬ÏÂÁîÃûÌÃÈçÏ£º

top

µÇ¼ºó¸´ÖÆ

topÏÂÁî»áÏÔʾĿ½ñÔËÐеÄÀú³ÌÁбí £¬²¢Æ¾Ö¤CPUʹÓÃÂʾÙÐÐÅÅÐò¡£Äã¿ÉÒÔʹÓüüÅÌÉϵÄÆ«Ïò¼üÀ´Éó²é¸ü¶àµÄÀú³ÌÐÅÏ¢¡£

¶þ¡¢ÐÔÄܼà²â

¼à²âCPUʹÓÃÂÊ

ʹÓÃsarÏÂÁî¿ÉÒÔ¼à²âϵͳµÄCPUʹÓÃÂÊ £¬ÏÂÁîÃûÌÃÈçÏ£º

sar -u 1 10

µÇ¼ºó¸´ÖÆ

Õ⽫ÿÃëÖÓ²ÉÑùÒ»´ÎCPUʹÓÃÂÊ £¬²¢ÏÔʾ×î½ü10´Î²ÉÑùЧ¹û¡£

¼à²âÄÚ´æʹÓÃÇéÐÎ

ʹÓÃfreeÏÂÁî¿ÉÒÔ¼à²âϵͳµÄÄÚ´æʹÓÃÇéÐÎ £¬ÏÂÁîÃûÌÃÈçÏ£º

free -m

µÇ¼ºó¸´ÖÆ

Õ⽫ÏÔʾϵͳµÄÄÚ´æ×ÜÁ¿¡¢ÒÑʹÓõÄÄÚ´æÁ¿ºÍÊ£ÓàÄÚ´æÁ¿¡£

¼à²â´ÅÅÌIO

ʹÓÃiostatÏÂÁî¿ÉÒÔ¼à²âϵͳµÄ´ÅÅÌIOÇéÐÎ £¬ÏÂÁîÃûÌÃÈçÏ£º

iostat

µÇ¼ºó¸´ÖÆ

iostatÏÂÁî»áÏÔʾÿ¸ö´ÅÅ̵ĶÁдËÙÂÊ¡¢Æ½¾ùÏìӦʱ¼äµÈÐÅÏ¢¡£

¼à²âÍøÂçÁ÷Á¿

ʹÓÃiftopÏÂÁî¿ÉÒÔ¼à²âϵͳµÄÍøÂçÁ÷Á¿ £¬ÏÂÁîÃûÌÃÈçÏ£º

iftop

µÇ¼ºó¸´ÖÆ

iftopÏÂÁî»áÏÔʾĿ½ñϵͳÉϸ÷¸öÍøÂç½Ó¿ÚµÄÊÕÖ§Á÷Á¿¡£

´úÂëʾÀý£º

ÒÔÏÂÊÇÒ»¸öʹÓÃPython±àдµÄ¼òÆÓµÄÀú³ÌÖÎÀí¹¤¾ß £¬¿ÉÒÔÁгöϵͳÉÏËùÓеÄÀú³Ì £¬²¢Æ¾Ö¤Àú³ÌIDÖÕֹij¸öÀú³Ì¡£

import os

# ÁгöϵͳÉÏËùÓеÄÀú³Ì
def list_processes():
    return os.popen('ps aux').read()

# ÖÕÖ¹Àú³Ì
def kill_process(pid):
    os.system('kill {}'.format(pid))

# ²âÊÔ´úÂë
if __name__ == '__main__':
    print('Ä¿½ñϵͳÉϵÄÀú³Ì£º')
    processes = list_processes()
    print(processes)

    pid = input('ÊäÈëÒªÖÕÖ¹µÄÀú³ÌID£º')
    kill_process(pid)

    print('Àú³ÌÒÑÖÕÖ¹¡£')

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊǹØÓÚÔõÑù¾ÙÐÐLinuxϵͳµÄÀú³ÌÖÎÀíºÍÐÔÄܼà²âµÄһЩ¼¼ÇɺʹúÂëʾÀý¡£Í¨¹ýÕâЩ¹¤¾ßºÍÊÖÒÕ £¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÏàʶϵͳµÄÔËÐÐ״̬ £¬ÊµÊ±ÖÕÖ¹ÎÊÌâÀú³Ì²¢ÓÅ»¯ÏµÍ³ÐÔÄÜ¡£Ï£Íû¶ÔÄãÓÐËù×ÊÖú£¡

ÒÔÉϾÍÊÇÔõÑù¾ÙÐÐLinuxϵͳµÄÀú³ÌÖÎÀíºÍÐÔÄܼà²âµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿