
eine schönere Möglichkeit, Netzwerkverbindungen zu überprüfen
ein freundlicheres ss / netstat für Menschen. Untersuche Netzwerkverbindungen mit einem aufgeräumten TUI oder gestalteten Tabellen.

brew install snitch
Danke an @bevanjkay für das Hinzufügen von snitch zu homebrew-core
go install github.com/karol-broda/snitch@latest
nix-env -iA nixpkgs.snitch
Danke an @DieracDelta für das Hinzufügen von snitch zu nixpkgs
# try it
nix run github:karol-broda/snitch
# install to profile
nix profile install github:karol-broda/snitch
# or add to flake inputs
{
inputs.snitch.url = "github:karol-broda/snitch";
}
# then use: inputs.snitch.packages.${system}.default
füge snitch zu deinen Flake-Inputs hinzu und importiere das home-manager-Modul:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
snitch.url = "github:karol-broda/snitch";
};
outputs = { nixpkgs, home-manager, snitch, ... }: {
homeConfigurations."user" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
snitch.homeManagerModules.default
{
programs.snitch = {
enable = true;
# optional: use the flake's package instead of nixpkgs
# package = snitch.packages.x86_64-linux.default;
settings = {
defaults = {
theme = "catppuccin-mocha";
interval = "2s";
resolve = true;
};
};
};
}
];
};
};
}
verfügbare Themes: ansi, catppuccin-mocha, catppuccin-macchiato, catppuccin-frappe, catppuccin-latte, gruvbox-dark, gruvbox-light, dracula, nord, tokyo-night, tokyo-night-storm, tokyo-night-light, solarized-dark, solarized-light, one-dark,
# with yay
yay -S snitch-bin
# with paru
paru -S snitch-bin
curl -sSL https://raw.githubusercontent.com/karol-broda/snitch/master/install.sh | sh
installiert nach ~/.local/bin, falls verfügbar, andernfalls nach /usr/local/bin. Überschreibbar mit:
curl -sSL https://raw.githubusercontent.com/karol-broda/snitch/master/install.sh | INSTALL_DIR=~/bin sh
macOS: Das Installationsskript entfernt automatisch das Quarantäne-Attribut (
com.apple.quarantine) von der Binärdatei, damit sie ohne Gatekeeper-Warnungen ausgeführt werden kann. Zum Deaktivieren setzeKEEP_QUARANTINE=1.
Vorgefertigte OCI-Images sind über die GitHub Container Registry verfügbar:
# pull from ghcr.io
docker pull ghcr.io/karol-broda/snitch:latest # alpine (default)
docker pull ghcr.io/karol-broda/snitch:latest-alpine # alpine (~17MB)
docker pull ghcr.io/karol-broda/snitch:latest-scratch # minimal, binary only (~9MB)
docker pull ghcr.io/karol-broda/snitch:latest-debian # debian trixie
docker pull ghcr.io/karol-broda/snitch:latest-ubuntu # ubuntu 24.04
# or use a specific version
docker pull ghcr.io/karol-broda/snitch:0.2.0-alpine
Alternativ lokal über Nix-Flake bauen:
nix build github:karol-broda/snitch#snitch-alpine
docker load < result
Container ausführen:
# basic usage - sees host sockets but not process names
docker run --rm --net=host snitch:latest ls
# full info - includes PID, process name, user
docker run --rm --net=host --pid=host --cap-add=SYS_PTRACE snitch:latest ls
| Flag | Zweck |
|---|---|
--net=host | Host-Netzwerk-Namespace teilen (erforderlich, um Host-Verbindungen zu sehen) |
--pid=host | Host-PID-Namespace teilen (für Prozessinformationen benötigt) |
--cap-add=SYS_PTRACE | Prozessdetails aus /proc/<pid> lesen |
Hinweis:
CAP_NET_ADMINundCAP_NET_RAWwerden nicht benötigt. snitch liest aus/proc/net/*, was keine speziellen Netzwerk-Capabilities erfordert.
Lade von den Releases herunter:
snitch_<version>_linux_<arch>.tar.gz oder .deb/.rpm/.apksnitch_<version>_darwin_<arch>.tar.gztar xzf snitch_*.tar.gz
sudo mv snitch /usr/local/bin/
macOS: Falls die Meldung „kann nicht geöffnet werden, da der Entwickler nicht verifiziert werden kann“ erscheint, führe Folgendes aus:
xattr -d com.apple.quarantine /usr/local/bin/snitch
snitch # launch interactive tui
snitch -l # tui showing only listening sockets
snitch ls # print styled table and exit
snitch ls -l # listening sockets only
snitch ls -t -e # tcp established connections
snitch ls -p # plain output (parsable)
snitch / snitch topInteraktives TUI mit live aktualisierter Verbindungsliste.
snitch # all connections
snitch -l # listening only
snitch -t # tcp only
snitch -e # established only
snitch -i 2s # 2 second refresh interval
Tastenkürzel:
j/k, ↑/↓ navigate
g/G top/bottom
t/u toggle tcp/udp
l/e/o toggle listen/established/other
s/S cycle sort / reverse
w watch/monitor process (highlight)
W clear all watched
K kill process (with confirmation)
/ search
enter connection details
? help
q quit
snitch lsEinmalige Tabellenausgabe. Verwendet automatisch einen Pager, wenn die Ausgabe die Terminalhöhe überschreitet.
snitch ls # styled table (default)
snitch ls -l # listening only
snitch ls -t -l # tcp listeners
snitch ls -e # established only
snitch ls -p # plain/parsable output
snitch ls -o json # json output
snitch ls -o csv # csv output
snitch ls -n # numeric (no dns resolution)
snitch ls --no-headers # omit headers
snitch jsonJSON-Ausgabe für Skripte.
snitch json
snitch json -l
snitch watchStreamt JSON-Frames in einem Intervall.
snitch watch -i 1s | jq '.count'
snitch watch -l -i 500ms
snitch upgradePrüft auf Updates und führt ein In-Place-Update durch.
snitch upgrade # check for updates
snitch upgrade --yes # upgrade automatically
snitch upgrade -v 0.1.7 # install specific version
Kurzflags funktionieren bei allen Befehlen:
-t, --tcp tcp only
-u, --udp udp only
-l, --listen listening sockets
-e, --established established connections
-4, --ipv4 ipv4 only
-6, --ipv6 ipv6 only
Optionen zur DNS- und Dienstnamen-Auflösung:
--resolve-addrs resolve ip addresses to hostnames (default: true)
--resolve-ports resolve port numbers to service names
--no-cache disable dns caching (force fresh lookups)
DNS-Lookups werden parallel durchgeführt und zur Leistungssteigerung zwischengespeichert. Verwende --no-cache, um den Cache für Debugging oder bei häufig wechselnden Adressen zu umgehen.
Für spezifischere Filterung verwende die key=value-Syntax mit ls:
snitch ls proto=tcp state=listen
snitch ls pid=1234
snitch ls proc=nginx
snitch ls lport=443
snitch ls contains=google
Gestaltete Tabelle (Standard):
╭─────────────────┬───────┬───────┬─────────────┬─────────────────┬────────╮
│ PROCESS │ PID │ PROTO │ STATE │ LADDR │ LPORT │
├─────────────────┼───────┼───────┼─────────────┼─────────────────┼────────┤
│ nginx │ 1234 │ tcp │ LISTEN │ * │ 80 │
│ postgres │ 5678 │ tcp │ LISTEN │ 127.0.0.1 │ 5432 │
╰─────────────────┴───────┴───────┴─────────────┴─────────────────┴────────╯
2 connections
Schlichte Ausgabe (-p):
PROCESS PID PROTO STATE LADDR LPORT
nginx 1234 tcp LISTEN * 80
postgres 5678 tcp LISTEN 127.0.0.1 5432
Optionale Konfigurationsdatei unter ~/.config/snitch/snitch.toml:
[defaults]
numeric = false # disable name resolution
dns_cache = true # cache dns lookups (set to false to disable)
theme = "auto" # color theme: auto, dark, light, mono
[tui]
remember_state = false # remember view options between sessions
Wenn remember_state = true ist, speichert und stellt das TUI Folgendes wieder her:
Der Zustand wird unter $XDG_STATE_HOME/snitch/tui.json gespeichert (Standard: ~/.local/state/snitch/tui.json).
CLI-Flags haben immer Vorrang vor dem gespeicherten Zustand.
SNITCH_THEME=dark # set default theme
SNITCH_RESOLVE=0 # disable dns resolution
SNITCH_DNS_CACHE=0 # disable dns caching
SNITCH_NO_COLOR=1 # disable color output
SNITCH_CONFIG=/path/to # custom config file path
/proc/net/*; Root oder CAP_NET_ADMIN für vollständige Prozessinformationenmono