History, tmux and Editors

History, Completion, tmux and Editing with nano and vim

Bash saves your commands in ~/.bash_history. Ctrl-R searches it as you type, and sudo !! reruns the last command as root. Ubuntu 225 's HISTCONTROL=ignoreboth drops duplicates and lines that begin with a space, so a leading space keeps a password out of the file. Tab completes names, and with the bash-completion package it completes options, package names and systemctl units too.

A command run over SSH dies with the connection. tmux 49,533 keeps it alive: detach, log out, and reattach later to find the migration still running. Its keys follow a prefix, Ctrl-b by default.

A tmux session that outlives its terminalShell
grep '^HIST' ~/.bashrc                       # Ubuntu's history defaults
tmux new-session -d -s deploy 'sleep 600'    # start a session, detached
tmux ls                                      # it runs with no terminal attached
tmux kill-session -t deploy
Output
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
deploy: 1 windows (created Wed Sep 23 13:19:00 2026)

Servers have no graphical editor. nano lists its keys on screen (^ means Ctrl). vim is modal: i enters Insert mode and Esc returns to Normal mode. EDITOR=vim sets what crontab -e and git open. Ubuntu 26.04 ships nano 8.7.1, Vim 9.1 13,171 and tmux 3.6.

The keys you need on the first day in nano, vim and tmux
Task nano vim tmux
Save / new window Ctrl-O :w Ctrl-b c
Quit / detach Ctrl-X :q, or :q! to discard Ctrl-b d
Search / next window Ctrl-W /text, then n Ctrl-b n
Go to line / split Ctrl-_ :42 Ctrl-b %
Reattach tmux attach -t deploy