python - 如何在 Mac 终端查看 Python 命令的整个历史记录

标签 python macos terminal

<分区>

有没有办法在 Mac 终端中查看 Python 的整个命令历史记录,从安装后的第一个命令“python”开始?

更新:因此,无法在 mac 终端中从 python 检索命令历史记录。 BobStein-VisiBone 在 how do you see the entire command history in interactive python? 中提出了最佳解决方案。他提到使用 iPython 的地方。不幸的是,即使这样也无助于检索在设置 iPython 之前在终端中输入的命令的历史记录。换句话说,这些命令可能永远消失了。

最佳答案

你可以试试:

history | grep "^[^a-zA-Z]*python *"

这将打印出所有以 python 开头的命令的终端历史记录

关于python - 如何在 Mac 终端查看 Python 命令的整个历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47503901/

相关文章:

python - VS Code集成终端粘贴时把剪贴板python代码搞乱

python - 用于以二进制形式提供 CLI 的 python3 存储库的 Bitbake Recipe

python - Python 3 中的 Django 问题 "super() argument 1 must be type, not WSGIRequest"

java - 如何知道mac平台是macOSx64还是macOSaarch64

linux - 如何在 Linux 或 OS X 上为 Swift 包生成代码覆盖率?

c++ - C代码如何在没有前导下划线的情况下调用外部函数?

linux - 自动将输入传递到终端?

visual-studio-2010 - Visual Studio代码终端-TypeError : Cannot read property 'execute' of undefined

python - pip 无法从 requirements.txt 安装软件包

python - 异步: run one function threaded with multiple requests from websocket clients