LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

extrace

trace exec() system calls system-wide

TLDR

Trace all program executions on the system
$ sudo extrace
copy
Trace descendants of a command only
$ sudo extrace [command]
copy
Print current working directory of each process
$ sudo extrace -d
copy
Resolve full path of each executable
$ sudo extrace -l
copy
Display user running each process
$ sudo extrace -u
copy

SYNOPSIS

extrace [options] [command]

DESCRIPTION

extrace traces exec() system calls system-wide to monitor program execution on Linux. It captures every time a program is executed, displaying the command line, process hierarchy, and optionally the user, working directory, and environment variables.Unlike strace which traces individual processes, extrace monitors all execution activity on the system or within a specific process tree. It's particularly useful for security auditing to detect suspicious process execution, debugging complex scripts that spawn multiple subprocesses, and understanding system behavior during package installations or automated tasks.The tool subscribes to the Linux kernel's netlink process connector (requires CONFIG_CONNECTOR and CONFIG_PROC_EVENTS) to receive exec notifications, so it captures activity without attaching a debugger to each process.

PARAMETERS

-d

Print the working directory of each process
-e
Print the process environment (or '-' if unreadable)
-f
Flat output, without tree indentation
-l
Resolve and show the full path of the executable
-q
Quiet; suppress printing of exec() arguments
-t
Print exit status and duration of each process
-u
Display the user running each process
-o file
Write trace output to file
-p pid
Trace only descendants of the given PID

INSTALL

sudo apt install extrace
copy
sudo zypper install extrace
copy
nix profile install nixpkgs#extrace
copy

CAVEATS

Requires root privileges and a kernel built with the process connector enabled. Linux-only. May impact system performance when tracing heavily.

SEE ALSO

strace(1), ltrace(1), auditd(8)

RESOURCES

Copied to clipboard
Kai