Skip to main content
filetrace is the command-line interface to Filetrace. Most commands ask the running agent (filetrace-agent) over a local socket and print what it has observed; a few check the machine or the configuration without an agent. This page covers what all commands share: the synopsis, the global options and environment variables, the privileges they need and how to get help.

Synopsis

Global options go before the command. Every option that takes a value accepts it as the next argument or after an equals sign, so --since 1h and --since=1h are the same.

Global options

string
default:"/run/filetrace/agent.sock"
Path of the agent socket to connect to. Without this option, the command uses $FILETRACE_SOCKET, then the [agent] socket setting of the configuration file, then the default. The macOS build, which has no collection, uses /var/run/filetrace/agent.sock as its default.
string
default:"/etc/filetrace/config.toml"
Configuration file to read. The commands take their default output format and the agent socket from it. A file named with this option must exist; see config.
boolean
Print the overview of commands and options. After a command, print that command’s help.
boolean
Print version and build information, the same as filetrace version.

Environment variables

Output that does not go to a terminal is never styled.

Running filetrace without a command

filetrace alone reports whether an agent is serving the socket and lists the commands. With an agent running, the status line names the backend, the probe set and the mode, followed by the number of active transfers and processes, the outbound rate and the share of events the agent received without loss:
Without an agent, the status line says how to start collecting:
When an agent is running but its socket is not accessible to your user, the status line says RUNNING and asks you to use sudo. The command exits with 0 in every case.

Commands

The help lists the commands in two groups. The main commands cover everyday work: More commands: The agent itself is a separate program, filetrace-agent.

Privileges

Only the agent needs the privileges to load BPF programs. The agent creates its socket so that only its owner can open it, and accepts connections only from root and from the user it runs as. When the agent runs as root, as the packaged service does, every command that queries it needs sudo:
A command that cannot open the socket reports Permission denied and exits with 3. When no agent is serving the socket, the query commands exit with 4 and say how to start one:
Two commands collect on their own instead: watch and events --follow start a collector in the foreground for as long as they run when no agent is running. Such a collector needs the same privileges as the agent, uses the [agent] settings of the configuration file, shows only activity from the moment it starts and exports nothing. Some commands do not need an agent at all: The command and the agent speak one protocol version. If they differ, the command reports that the agent speaks a different protocol version; upgrade filetrace and filetrace-agent together.

Getting help

filetrace help prints the overview of commands and global options. filetrace help <command> prints a command’s usage, options, examples and exit codes:
-h or --help anywhere among a command’s arguments does the same, so filetrace files --since 1h --help prints the help of files. The exception is filetrace agent run --help, which prints the help of the agent itself.

Exit codes

The commands share one set of exit codes: With code 9 the output is still printed; a warning on standard error gives the number of lost events and the affected time window, so standard output stays parseable. doctor, config and agent status give some codes a meaning of their own. Exit codes lists them all.

Command reference

watch

Live view of the transfers in progress.

files

Files associated with network transfers.

transfers

Transfer records, with unattributed bytes.

processes

Network activity per process.

connections

Open and recently closed sockets.

flows

Bytes per process, socket and remote endpoint.

top

Highest-volume processes, files, destinations or connections.

events

The agent’s records in order, past or live.

inspect

One file, process, socket, flow or address from every side.

agent

Run the agent, report its status or stop it.

filetrace-agent

The agent program and its options.

stats

The agent’s own events, losses and resources.

doctor

Whether and how well this machine can be monitored.

capabilities

Each feature and its status, with the reason.

config

Show, validate or locate the configuration file.

version

Version, build and platform information.
Filters and output formats describe the options that the listing commands share.