如何使用Bash在屏幕会话中获取命令历史记录? [英] How do I get the command history in a screen session using Bash?

查看:84
本文介绍了如何使用Bash在屏幕会话中获取命令历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用 screen -dmS名称启动屏幕会话,我将如何使用脚本访问该屏幕会话的命令历史记录?

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 last executed command appears, even in screen.

推荐答案

屏幕不会保留您键入的命令的历史记录。您的外壳可能保留也可能不保留历史。由于您似乎使用了 bash ,因此可以使用 history 命令。

screen doesn't maintain a history of the commands you type. Your shell may or may not keep a history. Since you appear to use bash, you can use the history command.

屏幕似乎与历史搜索大致相似(它只是在回滚缓冲区中搜索命令行。请参见屏幕历史命令下的手册页(默认情况下绑定到 Ca {)。

screen does appear to have a crude approximation of a history search (it merely searches the scrollback buffer for a command line. See the screen man page under the "history" command (bound to C-a { by default).

这篇关于如何使用Bash在屏幕会话中获取命令历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆