zoukankan      html  css  js  c++  java
  • 在top命令下kill和renice进程

    For common process management tasks, top is so great because it gives an overview of the most active processes currently running (hence the name top). This enables you to easily find processes that might need attention. From top, you can also perform common process management tasks, such as adjusting the current process priority and killing processes.

    [root@rhel7 ~]# top
    
    top - 22:58:17 up 27 min,  1 user,  load average: 0.00, 0.01, 0.05
    Tasks:  88 total,   2 running,  86 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    KiB Mem :  1884188 total,  1651932 free,    85420 used,   146836 buff/cache
    KiB Swap:  2097148 total,  2097148 free,        0 used.  1654104 avail Mem 
    
      PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                        
        1 root      20   0   44500   7104   2584 S  0.0  0.4   0:01.61 systemd                                        
        2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                                       
        3 root      20   0       0      0      0 S  0.0  0.0   0:00.01 ksoftirqd/0                                    
        7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0                                    
        8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh                                         
        9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0                                        
       10 root      20   0       0      0      0 S  0.0  0.0   0:00.66 rcu_sched                                      
       11 root      20   0       0      0      0 R  0.0  0.0   0:00.30 rcuos/0                                        
       12 root      rt   0       0      0      0 S  0.0  0.0   0:00.02 watchdog/0                                     
       13 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 khelper                                        
       14 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs                                      
       15 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns                                          
       16 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 perf                                           
       17 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback                                      
       18 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd                                    
       19 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset                                         
       20 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kblockd                                        
       21 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 md                                             
       22 root      20   0       0      0      0 S  0.0  0.0   0:01.04 kworker/0:1                                    
       26 root      20   0       0      0      0 S  0.0  0.0   0:00.00 khungtaskd                                     
       27 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kswapd0                                        
       28 root      25   5       0      0      0 S  0.0  0.0   0:00.00 ksmd                                           
       29 root      39  19       0      0      0 S  0.0  0.0   0:00.01 khugepaged                                     
       30 root      20   0       0      0      0 S  0.0  0.0   0:00.00 fsnotify_mark                                  
       31 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 crypto                                         
       39 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kthrotld                                       
       41 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kmpath_rdacd                                   
       42 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kpsmoused                                      
       43 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 ipv6_addrconf                                  
       63 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 deferwq                                        
       93 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kauditd                                        
      253 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 ata_sff

     Now that you know how to use the  kill  and  nice  commands from the command line, using the same functionality from top is even easier. From top, type  k . top will then prompt for the PID of the process you want to send a signal to. By default, the most active process is selected. After you enter the PID, top asks which signal you want to send. By default, signal 15 for SIGTERM is used. However, if you want to insist a bit more, you can type  9  for SIGKILL. Now press  Enter  to terminate the process.  

    To renice a running process from top, type  r . You are first prompted for the PID of the process you want to renice. After entering the PID, you are prompted for the nice value you want to use. Enter a positive value to increase process priority or a negative value to decrease process priority.  

  • 相关阅读:
    artTemplate的使用总结
    死锁的简单实现
    代理模式
    装饰器模式
    建造者模式
    工厂模式
    单例模式
    linux查看日志内容
    系统信息及系统操作
    设计模式-建造者模式
  • 原文地址:https://www.cnblogs.com/rusking/p/5626107.html
Copyright © 2011-2022 走看看