How to Clear Screen in Linux
Linux is full of commands that allow you to achieve every task with numerous commands. Having these text-based commands is handy; you can unleash the full potential of your Linux system. Moreover, the terminal is the most popular command line interface (CLI) for executing these commands.
While working in the terminal, the screen gets cluttered with various commands and their outputs. Hence, erasing everything from the terminal window is a basic yet essential task for users, especially those unfamiliar with the CLI. In this short article, we have included various methods to clear the screen in Linux
Clearing the screen is fundamental whether working in the terminal or accessing any remote server via SSH. There are three ways for it, so let’s take a look at all of them:
The clear Command
The clear is the most straightforward method to wipe the screen:
After executing the command, the system will immediately clear the terminal window, giving you a blank screen.
The Keyboard Shortcut
If you prefer keyboard shortcuts over commands, use CTRL+L. Unlike the clear command, this shortcut does not delete any contents of your current terminal window. Instead, it scrolls down the window to make it appear like the screen has been cleared. For example:
Now, press CTRL+L.
The ANSI Escape Sequences- Advanced Method
Advanced users or those proficient in terminal interactions can also use ANSI escape sequences to clear the screen. The escape sequence for this is ‘ 33[2J’, and it works very similar to the keyboard shortcut. For instance:
echo -e “