How to Clear Linux Terminal with Clear Command

How to, Programming

When working in the terminal, you may notice that your screen is full of commands and their outputs.

You might want to clear the terminal to free up space on the screen and focus on the next task at hand.
Trust me when I say that clearing the Linux terminal screen helps a lot.

Clear Linux terminal with clear command

So, under Linux, how do you clear the terminal? The clear command is the simplest and most usual method:

clear

The clear command has no options. It’s that easy, but there are a few more details to be aware of.

Clear terminal screen in Linux

Depending on the terminal emulator you’re running, the clear command and other ways for clearing the screen may differ.
The terminal emulator is the program that you use to access the Linux shell (command line).

When you run the clean command in Ubuntu’s GNOME Terminal, the screen is cleared, and you won’t be able to see what was previously on the screen.


Other ways to clear terminal screen in Linux

Clear Terminal Screen 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.

Ctrl+L

You’ll see the difference in their effects if you use Ctrl+L and the clear command in GNOME terminal (the default in Ubuntu).
Ctrl+L slides the screen down one page, providing the impression of a clean screen, although you can still scroll up to see the command output history.

Some other terminal emulators have this keyboard shortcut set at Ctrl+Shift+K.

You can also use the reset command to clear the terminal screen. In fact, this command totally re-initializes the terminal. It might take a little longer than a simple command, though.

reset

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:

alias cls='printf "\033c"'

This alias can be added to your bash profile to make it available as a command.


Click here to read more useful topics.

 

X-Soft

X-Soft is an established player in the IT market committed to providing excellent solutions for Web/ Mobile (iOS, Android, Web) around the globe. Namely, we are a team of professional web and mobile developers with 10+ years of experience.

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *