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 completely empty the screen in the Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "how to thoroughly clear the screen in the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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.

This is the end of the content of "how to thoroughly clear the screen in the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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