# Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

> A reference of shell keyboard shortcuts and CLI tricks in two tiers: universal POSIX commands and Bash/Zsh-specific enhancements for editing and history.

Published: 2026-03-26
URL: https://daniliants.com/insights/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/
Tags: shell, bash, zsh, terminal, cli, keyboard-shortcuts, posix, devops

---

## Summary

A well-organized reference of shell keyboard shortcuts and CLI tricks split into two tiers: universal POSIX-compatible commands and Bash/Zsh-specific enhancements. Covers line editing, history search, brace expansion, process substitution, backgrounding, and scripting safety flags.

## Key Insight

- The POSIX-portable tier (CTRL+W, CTRL+U/K/Y, CTRL+A/E, ALT+B/F, `cd -`, `pushd`/`popd`, `$_`, `> file.txt` truncation) works on minimal systems, SSH into embedded devices, and containers - worth committing to muscle memory first since they transfer everywhere
- `CTRL+U` cuts the line to a kill ring, and `CTRL+Y` yanks it back - this is a clipboard for your terminal that most people never discover, letting you "park" a half-written command while you run something else
- `CTRL+X CTRL+E` (Bash) or `fc` (portable) opens the current command in `$EDITOR` - critical for editing complex multi-pipe commands that outgrow the single-line prompt
- `set -euo pipefail` is the recommended scripting safety net, but the author correctly warns that `set -e` has non-obvious edge cases inside conditionals and pipelines - false confidence is worse than no safety net
- `disown` after `CTRL+Z` + `bg` lets you detach a running process from the shell after the fact - the rescue move when you forgot `tmux`/`screen`
- Brace expansion (`cp file{,.bak}`, `mv file.{txt,md}`, `mkdir -p project/{src,tests,docs}`) eliminates repetitive path typing and is underused even by experienced users