如何清除/删除终端当前行? [英] How do I clear/delete the current line in terminal?

查看:1034
本文介绍了如何清除/删除终端当前行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用终端以及键入一行文本的命令,有一个热键,或任何方式来清除/删除该行?

If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line?

例如,如果我的当前行/命令是一些真正长的很像:

For example, if my current line/command is something really long like:

> git log --graph --all --blah..uh oh i want to cancel and clear this line <cursor is here now>

有一个热键或命令从上面去:

Is there a hotkey or command to go from the above to:

>

通常我会preSS的<大骨节病>↓键,如果我的当前行是一个全新的历史上,这将清除它。但是如果我通过经历我的命令历史的<大骨节病>↑键,开始编辑,或者使用这些命令,<大骨节病>↓将在历史上提示仅更改为下一个最新的命令,所以,除非我preSS <大骨节病>↓多次不会在这里工作。

Usually I will press the key, and if my current line is a brand new one on the history, that will clear it. But if I'm going through my command history via the key and start editing or using those commands, will only change the prompt to the next newest command in history, so it doesn't work here unless I press multiple times.

推荐答案

您可以使用<大骨节病>控制 + <大骨节病> U 清理的开头。

You can use Ctrl+U to clear up to the beginning.

您也可以使用<大骨节病>控制 + <大骨节病> C 取消。

You can also use Ctrl+C to cancel.

如果你想保留的历史,你可以使用<大骨节病>替代 + <大骨节病>移 + <大骨节病>#使它成为一个注释。

If you want to keep the history, you can use Alt+Shift+# to make it a comment.

<子> 猛砸Emacs编辑模式小抄

这篇关于如何清除/删除终端当前行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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