wpail answers the question what port/application is listening? — like lsof -i :PORT or ss -ltnp, but purpose-built, fast, and with an interactive UI.
It is built for developers: instead of a bare PID or a cryptic temp path, wpail identifies your application — a listener started with go run . shows up under its project name (e.g. github.com/akhenakh/listener (go run)), with toolchain, project directory and VCS state one keypress away.
It reads the kernel tables directly (no shelling out to other tools), so it stays self-contained. Supported platforms:
- Linux — reads procfs (
/proc/net/*,/proc/<pid>/fd), builds without cgo. - FreeBSD — reads kernel PCB tables and open files via
sysctl; requires a C toolchain (cc, included in the FreeBSD base system). - macOS (Apple Silicon, arm64) — walks process file descriptors through
libproc; requires a C toolchain (the Xcode Command Line Tools, already present on any dev machine).
With Homebrew (macOS Apple Silicon and Linux):
brew install akhenakh/tap/wpailwpail is available in the AUR:
paru -S wpailRelease archives carry build provenance signed by this repository's release workflow. Check a downloaded archive with:
gh attestation verify wpail_Linux_x86_64.tar.gz --repo akhenakh/wpailwpail # interactive TUI over every listener (default with no args)
wpail -t 6666 # same TUI, filtered to one port
wpail 6666 # PIDs listening on TCP/UDP port 6666, one per line
wpail -u 6666 # PID + owning user
wpail -v 6666 # verbose: PID, user, build metadata per listener
wpail -c 6666 # active sessions attached to port 6666 (remote peer + local program)wpail -c PORT lists the live sessions accepted by a port and, for loopback
clients, the program on the other end:
PROTO STATE LOCAL REMOTE PEER
tcp ESTABLISHED 127.0.0.1:8080 127.0.0.1:40000 github.com/you/web (go run) [418002]
tcp ESTABLISHED 127.0.0.1:8080 10.0.0.7:52344 —
The peer column is resolved by matching the kernel's mirrored socket (the client's connected socket) against the fd table, so it identifies programs on this host; remote peers only contribute their IP and port.
Exit codes: 0 found, 1 nothing found / scan error, 2 usage error.
Both TCP and UDP sockets whose local port equals the argument — TCP only counts the LISTEN state; UDP has no listen state so any bound socket matches. IPv4 and IPv6 (tcp6, udp6) are included.
Temp binaries from go run . or cargo run are identified instead of shown
as cryptic temp paths. The list view labels them with the full module
path — github.com/akhenakh/listener (go run) — falling back to the short
project name when the path would be too long. The process detail view has a
Build block with module path, toolchain, project directory and VCS
state, and wpail -v PORT prints the same per PID:
PID USER BUILD PROJECT RUNTIME VCS DIR
417913 akh go run listener go1.27.0 main b784* /home/akh/dev/listener
417940 akh cargo listener rustc 1.95.0 (5980… - /home/akh/dev/listener
Everything is agentless, read straight from the binaries:
- Go — the embedded buildinfo blob (
debug/buildinfo): main module path, Go version, VCS revision/branch and dirty flag. Survives-s -wand stays readable aftergo rununlinks the temp binary, since wpail opens the live/proc/<pid>/exeinode. - Rust — the ELF
.commentsection (rustc version …, survivesstrip --strip-all),target/{debug,release}path conventions andCargo.tomlfor the project name. - Zig —
.comment(zig X.Y.Z, debug builds only),zig-out/binand thezig runcache paths.
wpail -t shows a live table of listeners: port, protocols, local address(es), session count, PID(s), process and user.
| Key | Action |
|---|---|
↓/↑, j, g/G |
move selection |
enter or i |
process detail: command line, exe path, owner, RSS memory, active sessions (including ones accepted by worker processes), all bound ports, plus a Build block (module, toolchain, project dir, VCS) for developer builds |
↑/↓, pgup/pgdn, home/end, wheel |
scroll a detail panel taller than the screen (the title shows the visible line range) |
/ |
filter the list as you type (port, protocol, address, PID, process or user); enter keeps it, esc cancels, ctrl+u clears |
k |
send a signal — a dialog opens to pick SIGTERM, SIGKILL, SIGINT, SIGHUP, SIGQUIT or SIGSTOP |
r |
refresh now (the list also auto-refreshes every 2 s) |
q / ctrl+c |
quit |
Killing is permission-checked up front: if you are not the owner of the target process (and not root), wpail explains that instead of dying on EPERM. Sockets vanish from the table right after a successful signal.
Without root, visibility depends on the OS and its security policy (for example, macOS hides other users' descriptors) — unidentified rows appear as pid —; rerun with sudo for the full system view.
Requires Go 1.27+ (and on macOS or FreeBSD, a C toolchain for cgo).
task build # binary in bin/wpail (static on Linux, links libSystem on macOS, libc on FreeBSD)
task check # vet + go fix + tests + build
task test # unit tests only
task listener # launch the dev listener fixture app (`go run .`, port 18081),
# then inspect it: task run -- -v 18081Or without task:
# Linux — no cgo needed:
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o bin/wpail .
go install github.com/akhenakh/wpail@latest # once publishedOn macOS and FreeBSD keep cgo enabled (it is by default); CGO_ENABLED=0 breaks the libproc and sysctl backends there.
- Linux:
- Parse
/proc/net/{tcp,tcp6,udp,udp6}for listening sockets and every connected session (kernel prints addresses as little-endian hex words). - Walk
/proc/<pid>/fd/*symlinks of the formsocket:[inode]to map each socket inode to owning PIDs. - Pair the two halves of a local connection by matching mirrored 4-tuples (IPv4-mapped IPv6 addresses are normalized so dual-stack listeners still match), which attributes the client program as the session's peer.
- Enrich PIDs from
/proc/<pid>: uid → username via NSS, cmdline/comm, exe link, VmRSS memory.
- Parse
- FreeBSD:
- Query
net.inet.tcp.pcblistandnet.inet.udp.pcblistviasysctlfor every TCP PCB (state, local and foreign endpoint) and every bound UDP socket. - Query
kern.file(struct xfile) to map each socket's kernel pointer (xf_data/xso_so) to owning PIDs. - Pair local session halves through their mirrored 4-tuples, exactly like the Linux backend, to name the client program.
- Enrich PIDs via
kern.proc.{pid,pathname,args,cwd}sysctls for UID/username, command line, executable path, working directory and RSS memory.
- Query
- macOS (arm64):
- Enumerate all processes with
proc_listallpids, list each one's file descriptors withproc_pidinfo(PROC_PIDLISTFDS). - Resolve socket descriptors via
proc_pidfdinfo(PROC_PIDFDSOCKETINFO); keep TCP sockets in listen state and bound UDP sockets. - Enrich PIDs from
PROC_PIDTBSDINFO/PROC_PIDTASKINFOand thekern.procargs2sysctl.
- Enumerate all processes with
main.go CLI parsing, output rendering, signal delivery
listen/ platform-neutral snapshot API + per-OS scanners (procfs / sysctl / libproc)
bininfo/ agentless build metadata from process binaries (go/rust/zig)
dev/listener/ standalone fixture app (`task listener`) for trying wpail out
tui/ Bubble Tea v2 model/view/update, lipgloss styling
- macOS support is arm64-only by design (
darwin && arm64build tags). - Session tracking (
-c, theCONNScolumn and the detail block) works on Linux and FreeBSD; the macOS libproc backend still lists listeners only. - Session tracking is snapshot-based: connections shorter than the scan
interval can be missed, and
TIME_WAITrows carry no inode, so their local owner can no longer be identified. Unconnected UDP (sendto/recvfrom) leaves no peer in/proc/net/udp; closing those gaps needs eBPF on Linux. - The list refreshes at a fixed cadence rather than reacting to socket events.
-uprints processes known to your current privileges; run as root (or withsudo) when auditing services.