小编Sla*_*ast的帖子

查看一系列 bash 历史记录

history命令列出当前会话的所有历史记录。喜欢:

1 ls 
2 cd /root
3 mkdir something
4 cd something
5 touch afile
6 ls
7 cd ..
8 rm something/afile
9 cd ..
10 ls
11 history
Run Code Online (Sandbox Code Playgroud)

为了寻找感兴趣的项目,我可以管historygrep

history | grep ls
1 ls
6 ls
10 ls
Run Code Online (Sandbox Code Playgroud)

我还可以查看最后 3 个命令,例如:

history 3
11 history
12 history | grep ls
13 history 3
Run Code Online (Sandbox Code Playgroud)

但是我如何获得特定范围的历史?例如类似的东西:

history range 4 7
4 cd something
5 touch afile
6 ls
7 cd ..
Run Code Online (Sandbox Code Playgroud)

bash command-history

51
推荐指数
2
解决办法
3万
查看次数

标签 统计

bash ×1

command-history ×1