syscapture is a small Linux incident-diagnostics CLI for taking a quick,
human-readable snapshot of a running process. It reads live process information
from /proc (and uses ps when available) and writes the result as Markdown,
making it easy to save, share, and compare diagnostic reports.
Note
This project is under active development. Process metadata and open file
descriptors are currently implemented. The watch command and broader host,
memory, network, filesystem, and kernel collection are not implemented yet.
For a supplied process ID (PID), the current report includes:
- process state;
- parent process ID;
- kernel wait channel;
- program command;
- total number of open file descriptors, including standard input, output, and error; and
- a table of non-standard file descriptors, their targets, and whether the target has been deleted.
The report is printed to standard output, so it can be viewed in the terminal or
redirected to a .md file.
The capture tool is designed for Linux and requires:
- Bash;
- a mounted
/procfilesystem; - common command-line utilities:
awk,grep,ls,readlink, andwc; and - optionally,
ps(usually supplied byprocps). Ifpsis unavailable,syscapturefalls back to reading process metadata directly from/proc.
Building the included diagnostic workloads additionally requires GNU Make and a C compiler such as GCC.
No installation step is required. Clone the repository, enter its directory, and capture a running process:
./main.sh capture <PID>For example, capture the current shell and save the Markdown report:
./main.sh capture "$$" > diagnosis.mdYou can then inspect diagnosis.md in a text editor or any Markdown viewer.
Permissions matter: Linux only exposes process details that the current user is
allowed to inspect. Run syscapture as the same user as the target process, or
use appropriately elevated privileges when required by the system's /proc
security settings.
./main.sh <command> <PID>
Takes a one-time snapshot of a live process and writes a Markdown report to standard output.
./main.sh capture 1234
./main.sh capture 1234 > process-1234.mdThe command exits with an error if /proc/<PID> does not exist when collection
starts. A process can still exit during collection, so captures of short-lived
processes may be incomplete or fail.
./main.sh watch <PID>watch is currently a placeholder: it prints Watching..., waits ten seconds,
and exits. It does not yet collect repeated snapshots.
Output varies by process and by the permissions of the user running the tool. A report has the following general shape:
# Diagnosis Report
Report for Process 1234 at Wed Sep 23 14:30:00 EAT 2026
## Process Details
Process runtime stats
- State: S
- Parent Process PID: 1000
- Wait Channel: hrtimer_nanosleep
- Program Command: `/usr/bin/example`
### Open File list
Process 1234 has 4 Open File descriptors, this includes the standard streams
| File Descriptor | File Location | File Deleted |
|-----------------|---------------------|--------------|
| 3 | `/var/log/app.log` | NO |The repository contains small C programs for creating reproducible process conditions while developing or testing collectors. Build all of them with:
makeThis creates the following executables in bin/:
| Executable | Purpose | Usage |
|---|---|---|
bin/memory |
Allocates and touches a requested amount of memory, then sleeps. | bin/memory <size_mb> <seconds> |
bin/openfiles |
Opens each supplied file plus an unlinked temporary file, then sleeps for 120 seconds. | bin/openfiles <file> [file ...] |
bin/zombie |
Exercises child and grandchild process creation and waiting behavior. | bin/zombie <count> |
Start the workload in one terminal:
bin/memory 100 60Copy the PID printed by the program, then capture it from another terminal:
./main.sh capture <PRINTED_PID> > memory-report.mdbin/openfiles /etc/hosts /etc/resolv.confWhile it is sleeping, use the printed PID with capture. The report should show
the supplied files and the workload's deleted temporary file.
Remove generated workload binaries with:
make clean.
├── main.sh # CLI entry point and argument dispatch
├── lib/
│ ├── main.sh # Capture orchestration and report header
│ └── collector/
│ ├── host.sh # Placeholder for host-level collectors
│ └── process.sh # Process metadata and file-descriptor collectors
├── workloads/
│ ├── memory/main.c # Memory-allocation workload
│ ├── open_files/main.c # Open/deleted-file workload
│ └── zombie/main.c # Process-tree workload
└── Makefile # Builds workloads into bin/
The CLI sources lib/main.sh, which in turn loads the individual collectors.
Collectors write Markdown directly to standard output. This simple composition
model makes it straightforward to add a collector and call it from capture.
Check the Bash files for syntax errors:
bash -n main.sh lib/main.sh lib/collector/*.shBuild the C workloads with compiler warnings enabled:
make clean && makeWhen changing collectors, test against both a normal long-running process and the included workloads. Keep diagnostic output on standard output so redirection continues to produce a self-contained Markdown report.
- Linux is required because collection depends on
/proc. - Only one PID is accepted per invocation.
captureis a point-in-time report; it does not monitor changes over time.watchand host-level collection are placeholders.- Process and descriptor data can change while a report is being generated.
- Access to processes owned by another user may be restricted.
- There is not yet an automated test suite or packaged installer.
Reports may contain command names and sensitive filesystem paths. Review them before posting them in an issue, chat, or other public location.
Issues and pull requests are welcome. Keep changes focused, run the Bash syntax check, rebuild the workloads, and include a representative capture when adding or modifying a collector.
No license file is currently included. Until a license is added, the repository owner retains all rights to the source code.