Suivi des processus : Top et NetHogs Suivi des Processus : Top et NetHogs NetHogs

Suivi des processus : Top et NetHogs


Top et NetHogs sont deux programmes permettant d'afficher, en temps réel, des informations sur les processus :

Mise à jour : Debian 9.0

1 - Top

1.1 - Lancement

$ top
top - 23:46:55 up  5:39,  2 users,  load average: 0,31, 0,29, 0,25
Tasks: 253 total, 1 running, 252 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3,9 us, 1,9 sy, 0,0 ni, 94,1 id, 0,1 wa, 0,0 hi, 0,0 si, 0,0 st
KiB Mem : 8079424 total, 4446420 free, 1590796 used, 2042208 buff/cache
KiB Swap: 10485756 total, 10485756 free, 0 used. 6018580 avail Mem
PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                     
880 root 20 0 357228 109484 71464 S 6,2 1,4 19:38.12 Xorg
8207 philippe 20 0 31708 1552 1340 S 6,2 0,0 0:00.18 syndaemon
1 root 20 0 205256 7536 5236 S 0,0 0,1 0:01.43 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.31 ksoftirqd/0
5 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0,0 0,0 0:41.03 rcu_sched
8 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_bh
9 root rt 0 0 0 0 S 0,0 0,0 0:00.01 migration/0
10 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 lru-add-drain
11 root rt 0 0 0 0 S 0,0 0,0 0:00.16 watchdog/0
12 root 20 0 0 0 0 S 0,0 0,0 0:00.00 cpuhp/0
13 root 20 0 0 0 0 S 0,0 0,0 0:00.00 cpuhp/1
14 root rt 0 0 0 0 S 0,0 0,0 0:00.15 watchdog/1
15 root rt 0 0 0 0 S 0,0 0,0 0:00.01 migration/1
16 root 20 0 0 0 0 S 0,0 0,0 0:00.28 ksoftirqd/1
18 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 kworker/1:0H
19 root 20 0 0 0 0 S 0,0 0,0 0:00.00 cpuhp/2
20 root rt 0 0 0 0 S 0,0 0,0 0:00.16 watchdog/2
21 root rt 0 0 0 0 S 0,0 0,0 0:00.02 migration/2
22 root 20 0 0 0 0 S 0,0 0,0 0:00.36 ksoftirqd/2
24 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 kworker/2:0H
25 root 20 0 0 0 0 S 0,0 0,0 0:00.00 cpuhp/3
26 root rt 0 0 0 0 S 0,0 0,0 0:00.11 watchdog/3
27 root rt 0 0 0 0 S 0,0 0,0 0:00.00 migration/3
28 root 20 0 0 0 0 S 0,0 0,0 0:00.11 ksoftirqd/3
30 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 kworker/3:0H

L'affichage est réactualisé en permanence, par défaut toutes les trois secondes.

1.2 - Configuration de base

1.2.1 Résumé

L'affichage et la présentation des lignes du résumé sont modifiables en utilisant (plusieurs fois) les touches l, t ou p

1.2.2 Sélection des En-têtes du Tableau

Pour sélectionner les en-têtes à afficher et modifier leur position taper f (field).

Fields Management for window 1:Def, whose current sort field is %CPU
Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,
'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end!

* %CPU = CPU Usage DATA = Data+Stack (KiB)
* %MEM = Memory Usage (RES) nMaj = Major Page Faults
* PID = Process Id nMin = Minor Page Faults
PR = Priority nDRT = Dirty Pages Count
VIRT = Virtual Image (KiB) WCHAN = Sleeping in Function
RES = Resident Size (KiB) Flags = Task Flags <sched.h>
SHR = Shared Memory (KiB) CGROUPS = Control Groups
* COMMAND = Command Name/Line SUPGIDS = Supp Groups IDs
* S = Process Status SUPGRPS = Supp Groups Names
* NI = Nice Value TGID = Thread Group Id
* USER = Effective User Name OOMa = OOMEM Adjustment
PPID = Parent Process pid OOMs = OOMEM Score current
TIME+ = CPU Time, hundredths ENVIRON = Environment vars
UID = Effective User Id vMj = Major Faults delta
RUID = Real User Id vMn = Minor Faults delta
RUSER = Real User Name USED = Res+Swap Size (KiB)
SUID = Saved User Id nsIPC = IPC namespace Inode
SUSER = Saved User Name nsMNT = MNT namespace Inode
GID = Group Id nsNET = NET namespace Inode
GROUP = Group Name nsPID = PID namespace Inode
PGRP = Process Group Id nsUSER = USER namespace Inode
TTY = Controlling Tty nsUTS = UTS namespace Inode
TPGID = Tty Process Grp Id LXC = LXC container name
SID = Session Id RSan = RES Anonymous (KiB)
nTH = Number of Threads RSfd = RES File-based (KiB)
P = Last Used Cpu (SMP) RSlk = RES Locked (KiB)
* TIME = CPU Time RSsh = RES Shared (KiB)
SWAP = Swapped Size (KiB) CGNAME = Control Group name
CODE = Code Size (KiB)

Dans la liste qui apparaît :

Utiliser q pour revenir à l'affichage du tableau.

Dans l'exemple ci-dessous :

%CPU  %MEM PID   COMMAND                                     S NI  USER     TIME   
5,3 1,3 880 Xorg S root 19:12
4,0 3,3 8394 seamonkey S philippe 3:36
3,7 0,6 1511 panel-20-wavela S philippe 4:14
2,0 0,2 1519 panel-30-netloa S philippe 7:07
1,7 0,2 1524 panel-11-netloa S philippe 6:39
0,7 0,3 1229 xfwm4 S philippe 2:24
0,7 0,2 1537 panel-26-cpugra S philippe 2:43
0,7 0,2 1541 panel-17-system S philippe 1:46
0,7 0,5 8680 xfce4-terminal S philippe 0:12
0,3 7 rcu_sched S root 0:40
0,3 0,2 974 wicd S root 0:13
0,3 0,2 1542 panel-13-diskpe S philippe 0:13
0,3 0,2 1543 panel-25-diskpe S philippe 0:12
0,3 3,7 3654 thunderbird S philippe 9:10
0,3 2,1 8832 chromium S philippe 0:06
0,3 8891 kworker/0:0 S root 0:01
0,3 0,1 9094 top R philippe 0:02
D = en sommeil non interruptible
R = en cours d'exécution
S = en sommeil
T = tracé ou arrêté
Z = zombie

1.3 - Utilisation

1.3.1 - Aide

La touche h donne accès à un tableau d'aide

Help for Interactive Commands - procps-ng 3.3.12
Window 1:Def: Cumulative mode Off. System: Delay 3,0 secs; Secure mode Off.

Z,B,E,e Global: 'Z' colors; 'B' bold; 'E'/'e' summary/task memory scale
l,t,m Toggle Summary: 'l' load avg; 't' task/cpu stats; 'm' memory info
0,1,2,3,I Toggle: '0' zeros; '1/2/3' cpus or numa node views; 'I' Irix mode
f,F,X Fields: 'f'/'F' add/remove/order/sort; 'X' increase fixed-width

L,&,<,> . Locate: 'L'/'&' find/again; Move sort column: '<'/'>' left/right
R,H,V,J . Toggle: 'R' Sort; 'H' Threads; 'V' Forest view; 'J' Num justify
c,i,S,j . Toggle: 'c' Cmd name/line; 'i' Idle; 'S' Time; 'j' Str justify
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria
n,#,^O . Set: 'n'/'#' max tasks displayed; Show: Ctrl+'O' other filter(s)
C,... . Toggle scroll coordinates msg for: up,down,left,right,home,end

k,r Manipulate tasks: 'k' kill; 'r' renice
d or s Set update interval
W,Y Write configuration file 'W'; Inspect other output 'Y'
q Quit
( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
Type 'q' or <Esc> to continue

1.3.2 Navigation et recherche

1.3.3 Modification affichage contenu du tableau

1.3.4 Filtrage

1.3.5 Modification de la colonne de tri

1.3.6 Personnalisation

1.3.7 Envoi d'un signal à un processus

Pour tuer une tâche : k suivi du numéro du pid, suivi du signal (par défaut 15 - SIGTERM)

1.3.8 Modification de la gentillesse d'une tâche

Pour modifier la gentillesse d'une tâche : r (renice) suivi du numéro du pid et de la valeur (entre 19 et -20)

2- Nethogs

# nethogs

ou en spécifiant l'interface :

# nethogs device wlan0
NetHogs version 0.8.5-2

PID USER PROGRAM DEV SENT RECEIVED
3805 philip.. /opt/vivaldi/vivaldi-bin wlan0 92.410 2.612 KB/sec
3654 philip.. /usr/lib/thunderbird/thunderbird wlan0 0.096 0.130 KB/sec
2452 philip.. /usr/bin/firefox-esr wlan0 0.011 0.020 KB/sec
1499 philip.. /usr/bin/owncloud wlan0 0.000 0.000 KB/sec
? root unknown TCP 0.000 0.000 KB/sec

TOTAL 92.516 2.762 KB/sec