Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to thoroughly clear the terminal screen in the CentOS system

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to thoroughly clear the terminal screen in the CentOS system". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to thoroughly empty the terminal screen in the CentOS system".

Linux users, especially Ubuntu or CentOS users, are basically accustomed to using clear commands or Ctrl+L combination shortcuts to clear the terminal screen. However, this is not really emptying the screen, it just gives people the illusion that the screen is empty. But when you scroll up with the mouse, you can still see the output left by the previous command operation. This situation can cause us trouble when dealing with a large amount of text.

Many other ways to empty the screen can be found online, but they are basically variants of the clear command. So, how can you really empty the screen?

Coincidentally, I recently found an order that can completely solve our problems.

Printf "\ 033c" is exactly the command we need. It really clears the terminal screen, and its function is very similar to the CLS effect provided by CMD.EXE in DOS.

But what exactly is this order for? How does it work?

\ 033 = =\ x1B = = 27 = = ESC

Thus, this command becomes c, which is the escape code for "Full Reset (RIS)" in VT-XXX. All the terminals we use today are VT compatible, but if you find yourself using a very strange terminal, you may not be able to use this command. Printf is a built-in command in bash, which takes precedence over other executables.

We can also use another command, reset, which also clears the terminal screen, but we can still use the arrow keys to view the history command. One drawback of this command is that it is a bit slow to execute, perhaps because it does not send an ESC c instruction, but this command is obviously more compatible than the previous one.

The reset command is very useful when your terminal control is out of order. Have you ever encountered a situation where the input character does not appear at the position of the cursor? When you hit enter, the new prompt does not appear on the new line, but in front of the old prompt. The reset command is here to correct this problem. You can also use this command on CYGWIN.

Thank you for your reading, the above is the content of "how to thoroughly empty the terminal screen in the CentOS system". After the study of this article, I believe you have a deeper understanding of how to thoroughly empty the terminal screen in the CentOS system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report