"Turn" a few tips on how to clear the screen under Linux

Source: Internet
Author: User
Tags clear screen

In the DOS interface of Windows, the command to clear the screen is CLS, so what is the command to clear the screen in Linux? The following author shares several of the clean screen methods used under Linux.

1,Clear command , this command will refresh the screen, essentially just let the terminal Display page backward page, if you scroll up the screen can also see the previous operation information.

2,ctrl+l (lowercase L), this is a clear screen of the shortcut keys, this is the author in the work of the most use of a clear screen, clear screen effect and the same as the clear command.

3,Reset command , this command will completely refresh the terminal screen, the previous terminal input operation information will be emptied, so although relatively refreshing, but the entire command process is a bit slow, less use.

It is worth mentioning that the Reset command is very useful when your terminal controls the disorder. If the input character does not show the position of the cursor now. And when you hit the ENTER key, the new prompt doesn't appear on the new line.

Instead, it appears in front of the old prompt. The reset command can now be used to correct these problems.

4,printf "\033c" command ,

This command is what really clears the terminal screen, and its functionality is similar to the CLS effect provided by CMD.EXE in DOS. But what exactly does this command do? How does it work?

\033 = = \x1b = = = ESC

As a result, this command becomes <esc>c, which is the escape code for "full Reset (RIS)" in Vt-xxx. All of the terminals we use today are VT-compatible, and another way to do this is to:

On the keyboard Ctrl + V--->Esc--> enter C and back again. But if you find yourself using a very strange terminal (as the author once tested on putty), you may not be able to use this command.

printf is a built-in command in bash, with the priority of built-in commands being higher than other executable files.

Through the above 4 clear screen comparison, I like, in the path, such as the/usr/bin/directory. Create a new file that is named CLS, Plus Execute permissions , to write into the contents:

In this case, every time we need to clear the screen, we just need to enter the CLS command.

Original

"Turn" a few tips on how to clear the screen under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.