Command-line habits that prevent self-inflicted leaks — history, process visibility, and the shortcuts that make this easy to actually keep up.
Your shell history file is a plaintext log of everything you've typed — including anything sensitive you typed directly instead of piping in.
HISTCONTROL=ignorespace only works if you remember the leading space every time. For anything genuinely sensitive, prefer a credentials file with restricted permissions or an environment variable over typing a secret directly on the command line at all — see below.Command-line arguments aren't private — any other local user can see them.
ps outputThe one that doesn't get covered enough: reverse-i-search. If you're retyping commands you've already run, you're wasting real time every day.
Ctrl+R — start reverse search, type any substring of a past commandCtrl+R again — cycle to the next older matchEnter — run the matched commandCtrl+G or Esc — cancel and return to an empty prompt!! — re-run the last command!$ — reuse the last argument of the previous commandCtrl+A / Ctrl+E — jump to start / end of the lineCtrl+U — clear the line before the cursorSmall habits that keep sensitive output from lingering where it shouldn't.
less instead of cat for sensitive files — it doesn't dump the content into your terminal's scrollback bufferclear && printf '\e[3J'loginctl lock-session or your desktop environment's equivalent