首先让我在下面显示一个示例。

在shell(1)中,我执行了以下命令。

$ ping google.com
PING google.com (74.125.235.164) 56(84) bytes of data.
64 bytes from nrt19s12-in-f4.1e100.net (74.125.235.164): icmp_seq=1 ttl=54 time=2.85 ms
64 bytes from nrt19s12-in-f4.1e100.net (74.125.235.164): icmp_seq=2 ttl=54 time=3.42 ms

然后,打开另一个shell(2)并查看历史记录。
$ history
 .
 .
 .
 8720  exit
 8721  clear
 8722  history

在这种情况下,shell无法看到shell(1)执行的历史记录,但是我想查看每个shell中的所有bash历史记录。

所以我的问题是如何查看所有bash历史记录?有人知道如何破解吗?

提前非常感谢您!

最佳答案

您应该查看histappend shell选项和-ahistory标志:

如果将history -a放入PROMPT_COMMAND中,您将获得一个始终最新的.bash_history文件。

关于bash - 我如何查看所有bash历史记录?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15116806/

10-12 00:11
查看更多