- 6 Commands to Clear Linux Terminal
- 1) clear command
- 2) reset command
- 3) Using the Ctrl + L shortcut
- 4) Using the printf «3c» command
- 5) Clearing the Linux terminal for KDE
- 6) Clearing the Linux terminal for GNOME — Ubuntu 18.04
- Conclusion
- Как очистить терминал Linux
- Как очистить терминал в Linux
- How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]
- Clear Linux terminal with clear command
- Other ways to clear terminal screen in Linux
- How to Really Clear the Terminal Screen in Linux
- The problem with “clear”
- How “reset” solves the problem
- What else can “reset” do?
- Conclusion
- 6 команд для очистки терминала Linux
- 1) clear команда
- 2) reset команда
- 3) Использование the Ctrl + L горячей клавиши
- 4) Использование команды printf “3c”
- 5) Очистка терминала Linux для KDE
- 6) Очистка терминала Linux для GNOME – Ubuntu 18.04
6 Commands to Clear Linux Terminal
Sometimes, as you go about running commands on a Linux terminal, you may feel that the terminal is somewhat ‘filled up’ with commands and outputs of those commands. Therefore, you may want to clear the terminal to declutter it and continue from the top once more.
In this tutorial, we are going to outline how you can clear the Linux terminal.
1) clear command
Let’s assume that your terminal is full of commands and output as shown below
Run the clear at the bottom of the terminal prompt.
Results
The terminal screen gets cleared as shown below
2) reset command
Just as in the example above, you need to run reset command at the bottom of the terminal to clear the screen as shown.
Results
As shown below, the terminal has been re-initialized by the reset command.
There’s also the tput reset command which will also do the trick.
3) Using the Ctrl + L shortcut
Another Handy method of clearing the terminal is the use of ctrl+L keyboard shortcut. It will have the same effect as the clear or reset command.
4) Using the printf «\033c» command
Another method one can use is by typing printf «\033c» on the terminal prompt and hitting enter. This will also have the same effect of reinitilaizing the screen.
This can also be defined as an alias through
5) Clearing the Linux terminal for KDE
For a KDE terminal also referred to as Konsole, the following command comes in handy
This can also be aliased as shown
Furthermore, you can use the keyboard shortcut when dealing with Yakauke
6) Clearing the Linux terminal for GNOME — Ubuntu 18.04
For a GNOME terminal, like you would find in Ubuntu 18.04, you can add keyboard shortcuts as shown
Note:
When using the above-mentioned methods to clear the screen, you’ll notice that the screen (putty) is still scrollable. That is one call still scroll up using a mouse or cursor up key to the previous commands and their output. If you want to clear the screen without a scrollback use the command clear && clear :
Conclusion
In this article, we have shown how you can clear the Linux terminal. you are welcome to try out the commands outlined and provide feedback. Thank you.
Источник
Как очистить терминал Linux
Если вы хотите делать снимки экрана терминала Linux или вам хочется чтобы окно терминала перед выполнением команды с очень длинным выводом было пустым, вам понадобиться возможность очистки терминала.
Существует несколько способов это сделать. Можно воспользоваться горячей клавишей, или выполнить несколько команд. Можно очистить только текущий экран или полностью весь вывод. В сегодняшней статье мы расскажем как выполняется очистка терминала в Linux.
Как очистить терминал в Linux
Самый простой способ очистить терминал — воспользоваться сочетанием клавиш Ctrl + L. После нажатия этих клавиш весь уже существующий вывод переместиться вверх, так, что текущее окно терминала будет пустым:
Тем не менее вся история вывода не будет удалена, вы сможете легко получить к ней доступ просто пролистав немного вверх:
Но если вы не будете пытаться листать историю, окно будет чистым. Если этого вам мало, вы можете воспользоваться командой clear. Она полностью очищает вывод и к предыдущему выводу вы уже вернуться не сможете:
Для того чтобы утилита clear не очищала полностью историю вывода, доступную при прокрутке, а работала аналогично сочетанию клавиш Ctrl+L используйте опцию -x:
Но и у этой команды есть одна проблема. Если вы по ошибке вывели содержимое двоичного файла, ваш эмулятор может быть сломан. Все вводимые вами символы могут превратиться в кракозябры, а приглашение ввода вовсе перестанет работать. Такое происходит потому что в двоичных файлах могут случайно встретиться какие-нибудь управляющие последовательности, ломающие работу терминала.
В такой ситуации команда clear не поможет, здесь нужна команда reset:
Она сбрасывает терминал полностью, не только предыдущий вывод, но и любые настройки, заданные с помощью управляющих последовательностей. После её выполнения вы получите чистый терминал.
Как видите, очистить терминал Linux очень просто. А какие способы знаете вы? Напишите в комментариях!
Источник
How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]
Last updated October 27, 2020 By Abhishek Prakash 11 Comments
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:
You need no option with the clear command. It’s that simple but there are some additional things you need to know about it.
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
Clear command is not the only way to clear the terminal screen.
You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators.
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.
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:
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?
Like what you read? Please share it with others.
Источник
How to Really Clear the Terminal Screen in Linux
Normally we use the clear command or press “Ctrl + L” to clear the terminal screen in Linux. Although it works, in reality the screen is not cleared – only the previous output is shifted upwards outside of the viewable area. But what if the requirement is to actually clear the terminal screen?
In this article we will discuss the reset command that makes this possible. The article will also focus on another critical scenario where this command helps.
The problem with “clear”
As I have already mentioned in the beginning, the clear command is the most commonly used command when it comes to clearing the terminal screen in Linux, and to be honest, it does the job most of the time. However, the fact that it just shifts the previous output upwards could result in confusion at times.
For example, imagine a situation where you’re doing something really critical on the command line (such as monitoring network activity to detect a possible hacking attempt) that involves running a single or a set of commands again and again and using mouse scroll or PgUP and PgDown keys to compare/analyze the output.
Now, if you issue a clear command in between to clear the screen, the chances of you committing a mistake are high as it’s sometimes hard to differentiate where the output of the previous command ends and that of the current command begins.
For example, the following screenshot (taken after scrolling the terminal window up a bit) shows the use of “Ctrl + L” while running the ls -lart command again and again.
How “reset” solves the problem
If you take a quick look at the reset command’s man page, you’ll see that it says the command eventually initializes the terminal – or better put, re-initializes the terminal – instead of just manipulating the position of output which clear does.
Keep in mind, however, that the reset command does not have any effect on the state of the shell (bash), meaning it remains unaltered.
What else can “reset” do?
There are times when you accidentally try opening an executable file in the terminal window using the cat command. Needless to say, the output produced is all garbage as the file in question is a binary file.
That’s not a problem in most cases, as you can press “Ctrl + C” to get your prompt back and move on with your work. But sometimes the operation (displaying the contents of a binary file) could even result in your command line prompt getting corrupt:
And anything you write is also displayed as garbage characters.
That’s usually because somewhere in the binary data there are some control sequences that are interpreted by the terminal as requests to change the character set used to draw. To restore things back to normal, just run the reset command.
Note: type the reset command carefully as the characters displayed on the terminal will be garbage until the command is successfully executed.
Conclusion
To sum it up, the reset command is your friend-in-need – from actually clearing the terminal screen to fixing the terminal display, it’s usually your last resort. To learn more about the command, I’d encourage you to go through its man page.
Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.
Источник
6 команд для очистки терминала Linux
Иногда, когда вы запускаете команды на терминале Linux, вы можете почувствовать, что терминал несколько «заполнен» командами и выводами этих команд.
Таким образом, вы можете очистить терминал, чтобы очистить его и продолжить с вершины еще раз.
В этой статье мы расскажем, как вы можете очистить терминал Linux
1) clear команда
Выполните clear нижней части
Экран терминала очищается, как показано ниже.
2) reset команда
Как и в приведенном выше примере, вам нужно запустить команду reset в нижней части терминала, чтобы очистить экран, как показано.
Есть также команда сброса tput, которая также будет делать этот трюк.
3) Использование the Ctrl + L горячей клавиши
4) Использование команды printf “\033c”
Другой метод, который можно использовать, – напечатать printf “\ 033c” в командной строке терминала и нажать [enter].
Это также будет иметь тот же эффект от повторной инициализации экрана.
Это также можно определить как псевдоним через
5) Очистка терминала Linux для KDE
Для терминала KDE, также называемого Konsole, следующая команда удобна
Это также может быть псевдонимом, как показано
Кроме того, вы можете использовать сочетание клавиш при работе с Yakauke
6) Очистка терминала Linux для GNOME – Ubuntu 18.04
Для терминала GNOME, как и в Ubuntu 18.04, вы можете добавить сочетания клавиш, как показано на рисунке
Shift + ctrl + alt + c
При использовании вышеупомянутых методов для очистки экрана вы заметите, что экран (Putty) по-прежнему прокручивается. Это один вызов, который все еще прокручивается с помощью мыши или клавиши курсора вверх до предыдущих команд и их вывода. Если вы хотите очистить экран без прокрутки, используйте команду clear && clear:
Стоит добавить, что если вы подключаетесь к терминалу из Windows с помощью putty (или kitty), то, например, Ctrl + L не очистит экран, а просто поставит текущую строку в самый верх окна.
При этом вы всё-ещё сможете использовать полосу прокрутки, чтобы увидеть результат выполнения вызванных ранее команд. А в случае, если результат выполнения команды занимает не одну страницу, то вы опять-таки, скорее всего, запутаетесь в том где начало последнего вызова.
А вот команда clear действительно очищает весь этот “мусор”.
По этой теме понятно /
а вот как писать в Телеграм шрифтом Ижица или slav47
Ищу ищу ещё не нашёль (
Источник