Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scroll through command history of tmux?

C-b: gives you tmux command prompt.
Is there a way to scroll through the commands entered on it previously?
Up arrow or Ctrl p/n don't seem to work.

like image 272
Aman Jain Avatar asked Feb 22 '23 21:02

Aman Jain


1 Answers

Up and Down work in the default (Emacs) mode; if however, you have set vi-mode then you will need to either explicitly enter command mode (by pressing Escape once at tmux's command prompt—Ctrlb,:), or you can create keybinds for those commands in your .tmux.conf, thereby removing the need to change modes:

set -g status-keys vi
bind-key -t vi-edit Up   history-up
bind-key -t vi-edit Down history-down

Tmux's default bindings can be seen with Ctrlb,: and then entering lsk -t vi-edit. The defaults are, in this case:

bind-key -ct vi-edit   Up   history-up
bind-key -ct vi-edit   Down history-down

Note the -ct switch for command mode.

like image 198
jasonwryan Avatar answered Mar 05 '23 16:03

jasonwryan