How to search backwards on tmux
![Photo by Greg Lloyd 1969, Photo of Hypertext Editing System (HES) console at Brown University, circa October 1969.](/content/images/size/w2000/2023/01/terminal-input-HypertextEditingSystemConsoleBrownUniv1969.jpg)
![tmux logo, three terminal panes with the word "tmux" to the right](https://blog.karmacomputing.co.uk/content/images/2023/01/tmux-logo-medium-1.png)
How to search backwards/upwards on tmux.
To enable tmux scroll back history press:
Ctrl + b
and then [
.
That's the Control key, and b
, let go, and then press [
(the left square bracket).
You'll then be able to scroll backward/forward. But how do you search?
Hint: To go back and undo what you've done press q
.
How to search tmux history
After pressing Ctrl + b
then [
.
To search, press Ctrl + s
this will bring up the default (search down) behaviour:
![](https://blog.karmacomputing.co.uk/content/images/2023/01/tmux-search-history.png)
(search down)
will appear at the bottom of your current tmux
pane.How to search up tmux history (search backwards)
After pressing Ctrl + b
then [
.
To search backwards, press Ctrl + r
, and now you can search up
instead of down.
![](https://blog.karmacomputing.co.uk/content/images/2023/01/tmux-search-up.png)
(search up)
Hint: To keep iterating through search matches, press n
to go to the 'next' match.
See also "search copy mode" by Dennis Williamson on Stackoverflow