访问 vi 历史记录

发布于 2024-12-14 20:12:10 字数 103 浏览 1 评论 0原文

我只是不小心将一个 200 美元的 SSL 证书粘贴到私钥文件中并保存在 vi 中。私钥现已丢失。我知道我在替换并保存之前删除了现有数据。是否可以以某种方式检索这些数据?我想不,但我想我会问。

I just accidentally pasted a $200 SSL certificate in the private key file and saved in vi. The private key is now lost. I know I yanked the existing data before replacing it and saving. Is it possible to retrieve this data somehow? I think no, but I figured I'd ask.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

┊风居住的梦幻卍 2024-12-21 20:12:10

如果你还没有退出 vi,你可以直接 'p'.. 不?

If you haven't quit vi, you can just 'p'.. no?

小忆控 2024-12-21 20:12:10
  • 如果您的 vi 会话仍在运行,并且您尚未编写文件,只需执行 [esc]:q!您应该返回到原始文件。

  • 或者只需点击 p 粘贴您之前复制的内容。

  • 可能有一个id.rsa~文件挂在周围。如果是这样,那就是您的备份文件。

  • 听起来您已经编写了文件,所以您可能不走运。您可以生成一个新的密钥对并要求您的证书供应商重新颁发证书吗?

  • 将来,您可能需要考虑设置备份 vim 中的选项。这曾经是当时 Linux 发行版中的默认设置,但现在它绝对不是我的 mac 上的默认设置。

  • If your vi session is still running, and you haven't written your file yet, just do [esc]:q! and you should be back to your original file.

  • Or just hit p to paste the stuff you yanked previously.

  • You might have an id.rsa~ file hanging around. If so, that is your backup file.

  • It sounds like you've already written your file, so you are probably out of luck. Can you generate a new keypair and ask your cert vendor to re-issue the cert?

  • In the future, you might want to look into setting the backup option in vim. This used to be a default setting in Linux distributions back in the day, but it definitely isn't the default on my mac now.

无声静候 2024-12-21 20:12:10

如果您在覆盖数据之前猛拉数据,则可能仍然可以使用寄存器访问它(:help registers):

:registers

将向您显示所有寄存器的内容。

如果您找到丢失的文本,可以使用行开头显示的数字将其拉出,例如在正常模式下发出 "3p

更新:问题是关于 vi,而不是 vim,对吧?那么命令寄存器可能不存在;我认为 yank 寄存器 0-9 是 vim 扩展。

If you yanked the data before you overwrote it, it probably should still be accessible using registers (:help registers):

:registers

will show you the contents of all registers.

If you find the lost text, it can be yanked by using the number displayed at the beginning of the line, e.g. by issuing "3p in normal mode.

UPDATE: The question was about vi, not vim, right? Then the command registers might not exist; I think the yank registers 0-9 are a vim extension.

七月上 2024-12-21 20:12:10

我不认为你有备份设置(doc) ?如果没有,你不能做u吗?

I don't suppose you have backups set do you (doc)? If not, can't you do u?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文