|FORKSTAT(8)||System Manager's Manual||FORKSTAT(8)|
NAME¶forkstat - a tool to show process fork/exec/exit activity
SYNOPSIS¶forkstat [-c] [-d] [-D] [-e] [-E] [-g] [-h] [-l] [-r] [-s] [-S] [-q] [-x] [-X]
DESCRIPTION¶Forkstat is a program that logs process fork(), exec(), exit(), coredump and process name change activity. It is useful for monitoring system behaviour and to track down rogue processes that are spawning off processes and potentially abusing the system.
Note that forkstat uses the Linux netlink connector to gather process activity and this may miss events if the system is overly busy. Netlink connector also requires root privilege.
Forkstat will display several columns of process related information:
|Time||When the fork/exec/exit event occurred.|
|Event||Type of event.|
|PID||Process or thread ID.|
|Info||Parent or child if a fork, or process exit(2) value.|
|Duration||On exit, the duration the command ran for in seconds.|
|Process||The process name. The name will be in [ ] brackets if it is a kernel thread.|
OPTIONS¶forkstat options are as follow:
- use the process 16 character comm field for the process name rather than command line information.
- strip off the directory path from the process name.
- -D seconds
- specify duration in seconds to run forkstat.
- specify events to trace as a comma separated list. By default the fork,
exec and exit events are traced. Available events are:
Event Description fork forks exec execs exit exits core core dumps comm process name changes in comm field clone clone (normally on thread creation) ptrce ptrace attach or detach uid uid/gid events sid sid events all all the events above
- enable all events, equivalent to -e all
- show glyph annotations of events, useful for easier identification of different events.
- show brief help summary.
- set stdout to line-buffered mode.
- run with real time FIFO scheduling with maximum priority to keep up with high volumes of process events.
- show short process name information.
- show event statistics.
- run quietly and enable the -S option.
- show extra process related information: user ID and TTY of the process.
- equivalent to options -E -g -r -S -x, all events, glyphs, real time FIFO scheduling, statistics and extra process information.
EXAMPLES¶Show process activity with short process names and directory base path stripped off:
Trace forks and core dumps only:
Trace all events and print statistics at end:
Trace all events for 10 minutes:
Trace clones for 1 minute:
AUTHOR¶forkstat was written by Colin King <email@example.com>. Thanks also for contributions from Philipp Gesang.
This manual page was written by Colin King <firstname.lastname@example.org>, for the Ubuntu project (but may be used by others).
COPYRIGHT¶Copyright © 2014-2018 Canonical Ltd.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|4 December, 2018|