Skip to main content
Browse referenceAll guides
Back to Commands
Copy Mode

clear-history

Short form: clearhist

Remove and free the scrollback history for a pane. Reclaims memory used by long-running panes with large buffers.

How clear-history works

clear-history deletes a pane's scrollback history and frees the memory it used. Panes that run chatty programs for days can hold thousands of lines; with a large history-limit, that adds up across many panes.

It only removes history above the screen. What you see in the pane stays, so people often pair it with clearing the screen. -H also removes stored hyperlinks, and -t picks another pane.

It has no default key binding. Most people bind it to a key so they can wipe noisy output before running something new.

Synopsis

bash
tmux clear-history [-H] [-t target-pane]

Options

FlagDescription
-HAlso remove all hyperlinks stored for the pane
-t target-panePane whose history to clear

Examples

Clear the current pane's scrollback

bash
tmux clear-history

Clear pane 1's scrollback

bash
tmux clear-history -t 1

In .tmux.conf: Prefix + Ctrl+k wipes the current pane's scrollback.

bash
bind C-k clear-history \; display 'History cleared'

Free the scrollback in every pane on the server.

bash
for p in $(tmux list-panes -a -F '#{pane_id}'); do tmux clear-history -t "$p"; done

Default Keybinding

clear-history has no default key. Run it from a shell as tmux clear-history, type it at the command prompt (Ctrl+b then :), or give it a key with bind-key.

Common Mistakes

  • The visible screen is not cleared. Press Ctrl+L in your shell (or run clear) as well if you want a blank pane.
  • There is no undo. If you might need the output, save it first with capture-pane -p -S -.
  • Programs that keep their own history, such as less or vim, are not affected; only tmux's scrollback is cleared.

Pro Tips

  • •Useful to reclaim memory from panes with a huge history-limit
  • •Bind it to a key to quickly wipe noisy scrollback