如何在Mac OS X的终端中清除以前的输出? [英] How can I clear previous output in Terminal in Mac OS X?

查看:488
本文介绍了如何在Mac OS X的终端中清除以前的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 clear 命令会清除当前屏幕,但这只是通过打印很多换行符来实现的-清除的内容会向上滚动。 p>

是否有一种方法可以完全清除终端上的所有先前输出,以便即使向上滚动也无法到达?

解决方案

要手动清除终端,请执行以下操作:



+ K



命令 + K 用于较新的键盘



要清除终端程序从shell脚本中;



  / usr / bin / osascript -e'告诉应用程序系统事件以告知进程使用命令down'


来敲击 k的终端

I know the clear command that 'clears' the current screen, but it does this just by printing lots of newlines - the cleared contents just get scrolled up.

Is there a way to completely wipe all previous output from the terminal so that I can't reach it even by scrolling up?

解决方案

To clear the terminal manually:

+K

Command+K for newer keyboards

To clear the terminal from within a shell script;

/usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down'

这篇关于如何在Mac OS X的终端中清除以前的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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