Skip to content

Interactive view: tui

portcheck TUI

Run portcheck with no arguments in a terminal, or portcheck tui, to get a live, full-screen table of sockets. It starts with listening sockets only (press L for all), refreshes every 2 seconds (--interval changes this) and keeps your selection in place when rows move.

When stdin or stdout is not a terminal (pipes, CI), bare portcheck prints help instead, so scripts are never surprised by a full-screen UI; portcheck tui exits with status 2.

Keys

Key Action
Up / Down / J move the selection
Page Up / Page Down move one page
Home G / End Shift+G first / last row
/ filter: type to narrow, Enter keeps the filter, Esc clears it
Esc clear the filter
Tab cycle protocol: tcp+udp → tcp → udp
L toggle listening-only / all sockets
S / Shift+S next sort column (port, proto, state, pid, process, user) / reverse order
R refresh now
C copy the selected PID to the clipboard (OSC 52)
X K Del stop the selected process gracefully (asks first)
Shift+K force-kill the selected process (asks first)
? help
Q / Ctrl+C quit

The filter matches port, protocol, local and remote address, state, PID, process name and user, case-insensitively.

The status line at the bottom describes the selected row: who started the process and its command line, e.g. started by npm (4200) ← zsh (900) · node server.js. The kill confirmation shows the same "started by" chain.

Colors

  • Green rows are TCP listeners.
  • Container ports show e.g. docker:web; pressing X on one shows the docker stop command instead of stopping the proxy (see Containers).
  • Dimmed rows have an owner hidden from your user. Stopping one shows the privilege hint; see Permissions by OS.

Colors adapt to your terminal and are disabled with NO_COLOR=1 or --no-color.

Stopping processes

X asks "Stop node (pid 42379) listening on 3000? [y/N]". On Y, portcheck uses the same graceful-then-force procedure and safety guards as portcheck kill (with a 3 second grace period), shows the result in the status line, and refreshes.

Copying PIDs over SSH

C uses the OSC 52 escape sequence, which most modern terminals support, including over SSH and inside tmux (with set -g set-clipboard on).