首先让我在下面举一个例子.
在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
之后,打开另一个壳(2)并查看历史.
$history . . . 8720 exit 8721 clear 8722 history
在这种情况下,shell看不到shell(1)执行的历史记录,但是我想在每个shell中看到所有的bash历史记录.
所以我的问题是如何看到所有的bash历史?有谁知道如何黑客?
提前非常感谢!
您应该查看histappend shell选项和-a到历史的标志:
histappend
If set,the history list is appended to the file named by the value of the
HISTFILE
variable when the shell exits,rather than overwriting the file.
history
-a
Append the “new” history lines (history lines entered since the beginning of the current bash session) to the history file.