To view tmux command history, press Ctrl+b : and use the up/down arrows to cycle through previously used tmux commands. For shell command history within a tmux pane, use your shell's history feature (typically Ctrl+r or up arrow). To save tmux command history, add set -g history-file ~/.tmux_history
to your ~/.tmux.conf
file.
# View command history Ctrl+b :(then use up/down arrows) # Save command history to file echo "set -g history-file ~/.tmux_history" >> ~/.tmux.conf
tmux provides several types of history functionality that are useful for different purposes. Understanding these different history mechanisms can greatly improve your productivity.
There are three main types of history in tmux:
tmux maintains a history of commands entered in the command prompt (accessed with Ctrl+b :):
By default, tmux's command history is not saved between sessions. To enable persistent command history:
# Add to ~/.tmux.conf set -g history-file ~/.tmux_history
This configuration saves the command history to the specified file, making it available across tmux sessions and server restarts.
tmux keeps a record of terminal output for each pane, which you can access in copy mode:
The default scrollback size is 2000 lines. To increase it:
# Add to ~/.tmux.conf set -g history-limit 10000 # Increase to 10,000 lines