How do I get the command history in a screen session using Bash?

前端 未结 7 1734
悲&欢浪女
悲&欢浪女 2021-02-01 19:08

If I start a screen session with screen -dmS name, how would I access the command history of that screen session with a script?

Using the , the

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 19:52

    When you exit a terminal (or shell) the shell writes its history to $HISTFILE, so to get its history in another terminal you can type exit in the terminal you want the history of and it will get written.

    cat $HISTFILE
    #or tac, less, $EDITOR, ... depending on how you want to "access" it
    

提交回复
热议问题