在bash中取消删除已删除的命令 [英] undelete the deleted command in bash

查看:277
本文介绍了在bash中取消删除已删除的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你写了一个很长的命令,说 cd / very / long / path ,然后你做ctrl + c或ctrl +在结束),然后你意识到,你想要的命令回来,有没有办法得到完整的线没有重新打字。是否有任何技巧来更改 .bashrc ,以便 bash_history 跟踪shell上按下的键而不是



我已经回答了一个问题,在bash中,如何清除当前输入?并实现如果我们有这样的选项,这将是非常有益的。


b li> Ctrl + X Ctrl +
  • Ctrl + _ (下划线)。



  • 有关 bash 中的键绑定的完整列表,请参见 bind -P


    If you have written a really long command, say cd /very/long/path, and then you do ctrl+c or ctrl+u (if the cursor is at the end), and then you realise that you want the command back, is there any way to get the full line back without re-typing. Is there any trick to change .bashrc so that bash_history keep track of keys pressed on the shell and not just after the enter is hit.

    I have answered a question at In bash, how does one clear the current input? and realised if we have some option like this it would be very helpful.

    解决方案

    To undo, use either

    • Ctrl+X, Ctrl+U; or
    • Ctrl+_ (underscore).

    See bind -P for a full list of keybindings in bash.

    这篇关于在bash中取消删除已删除的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆