mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
translated
This commit is contained in:
parent
d0cbcd227c
commit
3cf7b127a2
@ -1,87 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip])
|
||||
[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]
|
||||
======
|
||||
|
||||
When you are working in the terminal, often you’ll find that your terminal screen is filled up with too many commands and their outputs.
|
||||
|
||||
You may want to clear the terminal to declutter the screen and focus on the next task you are going to perform. Clearing the Linux terminal screen helps a lot, trust me.
|
||||
|
||||
### Clear Linux terminal with clear command
|
||||
|
||||
So, how do you clear terminal in Linux? The simplest and the most common way is to use the clear command:
|
||||
|
||||
```
|
||||
clear
|
||||
```
|
||||
|
||||
You need no option with the clear command. It’s that simple but there are some additional things you need to know about it.
|
||||
|
||||
![][1]
|
||||
|
||||
_**The clear command and other methods of clearing screen may depend on the terminal emulator you are using.**_ Terminal emulator is the terminal application that you use for accessing the Linux shell (command line).
|
||||
|
||||
If you use clear command on Ubuntu with GNOME Terminal, it will clear the screen and you won’t be able to see what else you had on the screen previously.
|
||||
|
||||
In many other terminal emulators or Putty, it may just clear the screen for one page. If you scroll with mouse or PageUp and PageDown keys, you can still access the old screen outputs.
|
||||
|
||||
Frankly, it depends on your need. If you suddenly realize that you need to refer to the output of a previously run command, perhaps having that option available will be helpful.
|
||||
|
||||
### Other ways to clear terminal screen in Linux
|
||||
|
||||
![][2]
|
||||
|
||||
Clear command is not the only way to clear the terminal screen.
|
||||
|
||||
You can use Ctrl+L [keyboard shortcut in Linux][3] to clear the screen. It works in most terminal emulators.
|
||||
|
||||
```
|
||||
Ctrl+L
|
||||
```
|
||||
|
||||
If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you’ll notice the difference between their impact. Ctrl+L moves the screen one page down giving the illusion of a clean screen but you can still access the command output history by scrolling up.
|
||||
|
||||
**Some other terminal emulators have this keyboard shortcut set at Ctrl+Shift+K.**
|
||||
|
||||
You can also use reset command for clearing the terminal screen. Actually, this command performs a complete terminal re-initialization. It could take a bit longer than clear command, though.
|
||||
|
||||
```
|
||||
reset
|
||||
```
|
||||
|
||||
There are a couple of other complicated ways to clear the screen when you want to clear the screen completely. But since the command is a bit complicated, it’s better to use it as [alias in Linux][4]:
|
||||
|
||||
```
|
||||
alias cls='printf "\033c"'
|
||||
```
|
||||
|
||||
You can add this alias to your bash profile so that it is available as command.
|
||||
|
||||
I know this was a pretty basic topic and most Linux users probably already knew it but it doesn’t harm in covering the elementary topics for the new Linux users. Isn’t it?
|
||||
|
||||
Got some secretive tip on clearing terminal screen? Why not share it with us?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/clear-terminal-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1
|
||||
[3]: https://linuxhandbook.com/linux-shortcuts/
|
||||
[4]: https://linuxhandbook.com/linux-alias-command/
|
@ -0,0 +1,87 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip])
|
||||
[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕(初学者提示)
|
||||
======
|
||||
|
||||
在终端上工作时,通常会发现终端屏幕上显示了太多的命令及其输出。
|
||||
|
||||
你可能需要清除终端屏幕并专注于要执行的下一个任务。相信我,清除 Linux 终端屏幕会很有帮助。
|
||||
|
||||
### 使用 clear 命令清除 Linux 终端
|
||||
|
||||
那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 clear 命令:
|
||||
|
||||
```
|
||||
clear
|
||||
```
|
||||
|
||||
你无需使用 clear 命令选项。就是这么简单,但是你还需要了解其他一些内容。
|
||||
|
||||
![][1]
|
||||
|
||||
_ **clear 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。** _ 终端模拟器是用于访问 Linux Shell(命令行)的终端应用。
|
||||
|
||||
如果你在具有 GNOME Terminal 的 Ubuntu 上使用 clear 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。
|
||||
|
||||
在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 PageUp 和 PageDown 键滚动,那么仍然可以看到以前的屏幕输出。
|
||||
|
||||
坦白说,这取决于你的需要。如果你突然意识到需要引用以前运行的命令的输出,那么也许可以使用该方式。
|
||||
|
||||
### 在 Linux 中清除终端屏幕的其他方法
|
||||
|
||||
![][2]
|
||||
|
||||
clear 命令不是清除终端屏幕的唯一方法。
|
||||
|
||||
你可以在 Linux 中使用 Ctrl+L [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。
|
||||
|
||||
```
|
||||
Ctrl+L
|
||||
```
|
||||
|
||||
如果你在 GNOME terminal (Ubuntu 中默认)中使用 Ctrl+L 和 clear 命令,那么你会注意到它们的影响有所不同。Ctrl+L 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。
|
||||
|
||||
**某些其他终端模拟器将此键盘快捷键设置为 Ctrl+Shift+K**。
|
||||
|
||||
你也可以使用 reset 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 clear 命令要花费更长的时间。
|
||||
|
||||
```
|
||||
reset
|
||||
```
|
||||
|
||||
当你想完全清除屏幕时,还有几种其他复杂的方法可以清除屏幕。但是由于命令有点复杂,所以最好将它作为 [Linux 中的别名][4]:
|
||||
|
||||
```
|
||||
alias cls='printf "\033c"'
|
||||
```
|
||||
|
||||
你可以将此别名添加到你的 bash 配置文件中,以便作为命令使用。
|
||||
|
||||
我知道这是一个非常基本的主题,大多数 Linux 用户可能已经知道了,但这对于为新 Linux 用户介绍基本主题并没有什么坏处。是不是?
|
||||
|
||||
在清除终端屏幕上有些秘密提示吗?为什么不与我们分享呢?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/clear-terminal-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1
|
||||
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1
|
||||
[3]: https://linuxhandbook.com/linux-shortcuts/
|
||||
[4]: https://linuxhandbook.com/linux-alias-command/
|
Loading…
Reference in New Issue
Block a user