I know you can scroll line by line through the tmux command-prompt history (C-b :, then arrow through them).
I'm looking for a way to see a list of the last N-number of commands from that history, but I'm not finding a way to do this.
Is it possible?
copy-mode is the way to view history (and optionally copy stuff out of it). Just run: echo "set -g mouse on" >> ~/. tmux. conf and you'll be able to scroll.
After you have typed what you are looking for, use the CTRL-R key combination to scroll backward through the history. Use CTRL-R repeatedly to find every reference to the string you've entered. Once you've found the command you're looking for, use [Enter] to execute it.
Capture History Using Command Terminal After saving the contents to the capture buffer, the next step is to save it in the ~/tmux. log file. This is the designated file where the information gets stored.
The GNU history command keeps a list of all the other commands that have been run from that terminal session, then allows you to replay or reuse those commands instead of retyping them.
I don't think there is a way to do this without setting history-file
setting(Can tmux save commands to a file, like .bash_history?)
In .tmux.conf
add the line
set -g history-file ~/.tmux_history
After that is set, you can use standard file reading programs to get the N
th line. For example:
tail -n N ~/.tmux_history | head -n 1
where N
is number of your line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With