mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-09 01:30:10 +08:00
Merge pull request #6774 from lujun9972/translate-MjAwNjA4MDggRml4IFRoZSBEaXNwbGF5IGFuZCBDb25zb2xlIEdpYmJlcmlzaCBvbiBhIExpbnV4IC0gVW5peCAtIE9TIFggLSBCU0QgU3lzdGVtcy5tZAo=
translate done at 2017年 12月 26日 星期二 18:28:03 CST
This commit is contained in:
commit
d175a70742
@ -1,56 +0,0 @@
|
||||
translating by lujun9972
|
||||
Fix The Display and Console Gibberish on a Linux / Unix / OS X / BSD Systems
|
||||
======
|
||||
Sometimes my R & D result in the weird output on the screen。For example,accidentally I run cat command over binary file - cat /sbin/*。You will be not able to access your bash/ksh/zsh based terminal。It will be full of wired character sequences that can lock down your display。These characters will hide what you type or character displayed into strange symbols。To clear gibberish all over the screen use the following method。This article describes how to really clear the terminal screen or reset terminal in Linux or Unix-like system。
|
||||
|
||||
|
||||
## The clear command
|
||||
|
||||
The clear command clears your screen including its scrollback buffer。
|
||||
`$ clear`
|
||||
You can press CTRL+L to clear screen too。However,clear command won't clear the terminal screen。Use the following methods to really clear the terminal so you get a get back a good working terminal。
|
||||
|
||||
## How to fix the display using the rest command
|
||||
|
||||
Here is my console with gibberish all over the screen:
|
||||
[![Fig.01:Bash fix the display][1]][2]
|
||||
|
||||
To fix the display just type the reset command。It will initialization terminal again for you:
|
||||
`$ reset`
|
||||
OR
|
||||
`$ tput reset`
|
||||
|
||||
If reset command failed to work type the following command to restore the session to a normal state:
|
||||
`$ stty sane`
|
||||
|
||||
Press CTRL + L to clear the screen (or type the clear command):
|
||||
`$ clear`
|
||||
|
||||
## Use ANSI escape sequence to really clear the bash terminal
|
||||
|
||||
Another option is to type the following ANSI escape sequence:
|
||||
```
|
||||
clear
|
||||
echo -e "\033c"
|
||||
```
|
||||
|
||||
Sample outputs from both commands:
|
||||
[![Animated gif 01:Fix Unix Console Gibberish Command Demo][3]][4]
|
||||
Read man pages of stty and reset for more information stty(1),reset(1),bash(1)
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.cyberciti.biz/tips/bash-fix-the-display.html
|
||||
|
||||
作者:[Vivek Gite][a]
|
||||
译者:[lujun9972](https://github.com/lujun9972)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.cyberciti.biz
|
||||
[1]:https://www.cyberciti.biz/media/new/tips/2006/08/bash-fix-terminal.png
|
||||
[2]:https://www.cyberciti.biz/media/uploads/tips/2006/08/bash-fix-terminal.png
|
||||
[3]:https://www.cyberciti.biz/media/new/tips/2006/08/unix-linux-console-gibberish.gif
|
||||
[4]:https://www.cyberciti.biz/tips/bash-fix-the-display.html/unix-linux-console-gibberish
|
@ -0,0 +1,55 @@
|
||||
修复 Linux / Unix / OS X / BSD 系统 控制台上的显示垃圾
|
||||
======
|
||||
有时我的 R & D( 研究与发展??) 会在屏幕上输出一些奇怪的东西。比如,有一次我不小心用 cat 命令查看了一下二进制文件的内容 - `cat /sbin/*`。这种情况下你将无法再访问终端里的 bash/ksh/zsh 了。大量的奇怪字符充斥了你的终端 y。这些字符会隐藏你输入的内容和要显示的字符,取而代之的是一些奇怪的符号。要清理掉这些屏幕上的垃圾可以使用以下方法。本文就将向你描述在 Linux/ 类 Unix 系统中如何真正清理终端屏幕或者重置终端。
|
||||
|
||||
|
||||
## clear 命令
|
||||
|
||||
clear 命令会清理掉屏幕内容,连带它的回滚缓存区一起也会被清理掉。
|
||||
`$ clear`
|
||||
你也可以按下 `CTRL+L` 来清理屏幕。然而,clear 命令并不会清理掉终端屏幕(译者注:这句话比较难理解,应该是指的运行 clear 命令并不是真正的把以前显示的内容删掉,你还是可以通过向上翻页看到之前显示的内容)。使用下面的方法才可以真正地清空终端,使你的终端恢复正常。
|
||||
|
||||
## 使用 reset 命令修复显示
|
||||
|
||||
下面图片中,控制台的屏幕上充满了垃圾信息:
|
||||
[![Fig.01:Bash fix the display][1]][2]
|
||||
|
||||
要修复正常显示,只需要输入 `reset` 命令。它会为你再初始化一次终端:
|
||||
`$ reset`
|
||||
或者
|
||||
`$ tput reset`
|
||||
|
||||
如果 `reset` 命令还不行,那么输入下面命令来让绘画回复到正常状态:
|
||||
`$ stty sane`
|
||||
|
||||
按下 `CTRL + L` 来清理屏幕 (或者输入 clear 命令):
|
||||
`$ clear`
|
||||
|
||||
## 使用 ANSI 转义序列来真正地晴空 bash 终端
|
||||
|
||||
另一种选择是输入下面的 ANSI 转义序列:
|
||||
```
|
||||
clear
|
||||
echo -e "\033c"
|
||||
```
|
||||
|
||||
下面是这两个命令的输出示例:
|
||||
[![Animated gif 01:Fix Unix Console Gibberish Command Demo][3]][4]
|
||||
更多信息请阅读 stty 和 reset 的 man 页 stty(1),reset(1),bash(1)
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.cyberciti.biz/tips/bash-fix-the-display.html
|
||||
|
||||
作者:[Vivek Gite][a]
|
||||
译者:[lujun9972](https://github.com/lujun9972)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.cyberciti.biz
|
||||
[1]:https://www.cyberciti.biz/media/new/tips/2006/08/bash-fix-terminal.png
|
||||
[2]:https://www.cyberciti.biz/media/uploads/tips/2006/08/bash-fix-terminal.png
|
||||
[3]:https://www.cyberciti.biz/media/new/tips/2006/08/unix-linux-console-gibberish.gif
|
||||
[4]:https://www.cyberciti.biz/tips/bash-fix-the-display.html/unix-linux-console-gibberish
|
Loading…
Reference in New Issue
Block a user