FORKSTAT(8)

πŸ“¦
version 0.04.00 Β· 4 versions
, in debian trixie, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 FORKSTAT β€” the forkstat(8) page, bestie edition 🌸

okay so real talk, this is from the System Manager's Manual section 8, and it's literally the coolest little snitch for your system's process drama. let's get into it πŸ’…


✨ NAME ✨

forkstat β€” a tool to show process fork/exec/exit activity 🫢


✨ SYNOPSIS ✨

forkstat [options]

✨ DESCRIPTION ✨

So forkstat is this icon of a program that logs all your process fork(), exec(), exit(), coredump, and process name change activity. it's giving surveillance but make it helpful πŸ’– It's genuinely useful for monitoring how your system is behaving and for tracking down those rogue processes that just keep spawning off more processes and lowkey abusing the system. not on our watch, periodt.

⚠️ important tea: forkstat uses the Linux netlink connector to gather process activity, and because of that it may miss events if the system is overly busy. also the netlink connector requires root privilege, so yeah, you gotta be root. no cap.

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:

  • -c β€” use the process 16 character comm field for the process name rather than command line information.
  • -d β€” strip off the directory path from the process name.
  • -D seconds β€” specify duration in seconds to run forkstat.
  • -e β€” specify events to trace as a comma separated list. By default the fork, exec and exit events are traced. Available events are:
    • fork β€” forks
    • exec β€” execs
    • exit β€” exits
    • exitnonzero β€” non-zero 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
  • -E β€” enable all events, equivalent to -e all
  • -g β€” show glyph annotations of events, useful for easier identification of different events.
  • -h β€” show brief help summary.
  • -l β€” set stdout to line-buffered mode.
  • -p pgrpid β€” only show processes that match the process group id pgrpid
  • -r β€” run with real time FIFO scheduling with maximum priority to keep up with high volumes of process events.
  • -s β€” show short process name information.
  • -S β€” show event statistics.
  • -q β€” run quietly and enable the -S option.
  • -x β€” show extra process related information: user ID and TTY of the process.
  • -X β€” 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:

forkstat -s -d

Trace forks and core dumps only:

forkstat -e fork,core

Trace all events and print statistics at end:

forkstat -e all -S

Trace all events for 10 minutes:

forkstat -E -D 600

Trace clones for 1 minute:

forkstat -e clone -D 60

✨ SEE ALSO ✨


✨ AUTHOR ✨

forkstat was written by Colin Ian King <colin.i.king@gmail.com>. Thanks also for contributions from Philipp Gesang. 🫢

This manual page was written by Colin Ian King <colin.i.king@gmail.com>, for the Ubuntu project (but may be used by others).


Copyright Β© 2014-2021 Canonical Ltd, Copyright Β© 2021-2025 Colin Ian King.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

πŸ’€ not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, bestie. read it and weep.

and that's the whole thing! this page is living in the System Manager's Manual, dated 16 April 2025 β€” go forth and catch those rogue processes, you absolute main character πŸ‘‘βœ¨πŸ¦‹