feat: Filter by process #217

It is possible to filter by process id!
Add the -P <pid> flag.
Example: `nethogs -P 123 -P 333` to filter the processes: 123 and 333
This commit is contained in:
Matheus Rambo
2022-02-28 20:53:51 -03:00
parent ca8fa246be
commit cabc2a1ea3
3 changed files with 32 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ nethogs \- Net top tool grouping bandwidth per process
.RB [ "\-C" ]
.RB [ "\-b" ]
.RB [ "\-g period" ]
.RB [ "\-P pid" ]
.RI [device(s)]
.SH DESCRIPTION
NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most such tools do, it groups bandwidth by process - and does not rely on a special kernel module to be loaded. So if there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this, and if it's some kind of spinning process, kill it.
@@ -69,6 +70,9 @@ Display the program basename.
\fB-g\fP
garbage collection period in number of refresh. default is 50.
.TP
\fB-P\fP
Show only processes with the specified pid(s).
.TP
\fB-f\fP
EXPERIMENTAL: specify string pcap filter (like tcpdump). This may be removed or changed in a future version.
.TP
@@ -113,7 +117,9 @@ command, as follows:
sudo setcap "cap_net_admin,cap_net_raw+pe" /usr/local/sbin/nethogs
.EE
.in
.SH "Notes"
1. When using the -P <pid> option, in a case where a process exited (normally or abruptly), Nethogs does not track that it exited. So, the operating system might create
a new process (for another program) with the same pid. In this case, this new process will be shown by Nethogs.
.SH "SEE ALSO"
.I netstat(8) tcpdump(1) pcap(3)
.SH AUTHOR