在bash中,一个人如何清除当前输入? [英] In bash, how does one clear the current input?

查看:117
本文介绍了在bash中,一个人如何清除当前输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你开始编写像这样的命令的bash:

  $ RM -rf /富/酒吧/真的/长/路径/这里

,然后意识到你不想毕竟执行此。有没有办法清除输入一个或两个按键?

我一直在做最近为prepending回声和封闭在引号输入(按Ctrl + A,回声,按Ctrl + E,),然后按下回车键。是否有一个更快的方法?


解决方案

  1. preSS <大骨节病>控制 - <大骨节病> U 删除光标之前的一切。被删除的命令将被存储到缓冲区中。 preSS <大骨节病>控制 - <大骨节病>是粘贴删除命令

    (可选:preSS <大骨节病>结束或<大骨节病>控制 - <大骨节病>电子跳转到输入的结束首)


  2. 另外,preSS <大骨节病>控制 - <大骨节病> C 中止你正在输入的内容


Suppose in bash you start writing a command like:

$ rm -rf /foo/bar/really/long/path/here

and then realize you don't want to execute this after all. Is there a way to clear the input with one or two keystrokes?

What I have been doing lately is prepending echo and enclosing the input in quotes (Ctrl+A, echo ", Ctrl+E, ") then hitting enter. Is there a faster way?

解决方案

  1. Press Ctrl-U to delete everything before the cursor. The deleted command will be stored into a buffer. Press Ctrl-Y to paste the deleted command.

    (Optional: Press End or Ctrl-E to jump to the end of the input first.)

  2. Alternatively, press Ctrl-C to abort what you're typing.

这篇关于在bash中,一个人如何清除当前输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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