加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

我如何看到所有的bash历史?

发布时间:2020-12-15 18:42:04 所属栏目:安全 来源:网络整理
导读:首先让我在下面举一个例子. 在shell(1)中,我做了以下命令. $ping google.comPING 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 ms64 bytes from nrt19s12-in-f
首先让我在下面举一个例子.

在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.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读