2017-02-08 75 views
2

我知道你可以通過tmux命令提示歷史(C-b:,然後箭頭通過它們)逐行滾動。tmux:列出命令提示歷史?

我正在尋找一種方法來查看歷史記錄中最後N個命令的列表,但我找不到這樣做的方法。

可能嗎?

+1

投票結束這個問題作爲題外話。請注意,Stackoverflow僅用於編程相關的問題。請查看[幫助/在線主題],瞭解可在此處詢問哪些主題。該幫助還對其他SE網站提出了適合此問題的建議。 – kaylum

+0

請閱讀http://stackoverflow.com/help/how-to-ask,http://stackoverflow.com/help/dont-ask,http://stackoverflow.com/help/mcve並參加[tour] (http://stackoverflow.com/tour),然後再發布更多Q​​值。祝你好運。 – shellter

回答

2

我不認爲有一種方法可以做到這一點沒有設置history-file設置(Can tmux save commands to a file, like .bash_history?

.tmux.conf

set -g history-file ~/.tmux_history 

之後,你可以做非標準文件閱讀計劃,獲得第N行

tail -n N ~/.tmux_history | head -n 1 

哪裏N是你的行數