码迷,mamicode.com
首页 > 系统相关 > 详细

在top命令下kill和renice进程

时间:2016-06-29 11:11:35      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:

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.  

 

在top命令下kill和renice进程

标签:

原文地址:http://www.cnblogs.com/rusking/p/5626107.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!