这个问题似乎与 a specific programming problem, a software algorithm, or software tools primarily used by programmers 无关.如果您认为该问题将成为 another Stack Exchange site 上的主题,您可以发表评论,说明在哪里可以回答问题。
关闭去年。
bash history
命令非常酷。我明白为什么它显示行号,但是有没有办法可以调用历史命令并取消行号?
这里的重点是使用history命令,所以请不要回复cat ~/.bash_history
电流输出:
529 man history
530 ls
531 ll
532 clear
533 cd ~
534 histor<em>y</em>
Historical graphic source.
期望的输出:
man history
ls
ll
clear
cd ~
histor<em>y</em>
Historical graphic source.
感谢大家的出色解决方案。 Paul's 是最简单的,并且对我有用,因为我的 bash 历史大小设置为 2000。
我还想分享我今天早上发现的一篇很酷的文章。它有几个我现在正在使用的好选项,比如将重复条目排除在 bash 历史记录之外,并确保多个 bash session 不会覆盖历史文件:http://blog.macromates.com/2008/working-with-history-in-bash/
最佳答案
试试这个:
$ history | cut -c 8-
https://stackoverflow.com/questions/7110119/