在bash中取消删除已删除的命令

编程入门 行业动态 更新时间:2024-10-26 20:23:41
本文介绍了在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中取消删除已删除的命令

    本文发布于:2023-10-24 09:51:07,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:命令   bash

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!