linux - 没有行号的 Bash 历史记录

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/

相关文章:

python - 为什么在 Python 3 中 x**4.0 比 x**4 快?

linux - 在 Linux 脚本中隐藏终端上的用户输入

python - Windows Scipy 安装 : No Lapack/Blas Resourc

python - 如何在使用 Python 插入 MySQL 数据库后获取 "id"?

python - 在 SQLAlchemy 中使用 OR

python - pandas 获取不在其他数据框中的行

linux - Mac 和 Linux 上的文本文件中的递归搜索和替换

linux - 如何删除具有特定名称的文件夹

linux - 遍历 ls -l 输出的每一行

linux - 如何在 Bash 中运行超时的进程?