从 SSH 命令行历史记录中删除特定历史记录

Remove specific history from SSH command line history

我不小心在我的 SSH 中输入了一些内容,现在显示了我的密码(显然我想删除它)

当我输入以下命令时,我会看到我的所有历史记录如下:

$ history

历史列表:

997  sudo svn up
998  sudo svn up
999  sudo svn
1000 mypasswordhere
1001 history

我只需要从我的历史记录中删除条目 1000 mypasswordhere(mypasswordhere 是我实际用于某些网站的密码,因此需要删除它)

谁能建议如何删除这个单个条目(而不是尽可能删除所有条目)

这应该通过执行以下命令来完成:

$ history -d 1000

根据您编写 man history

时可访问的文档