How to remove or clear all the text on the terminal on Linux?

December 31, 2022 - 1 min read

To remove or clear all the text on the terminal, you can use the clear Linux command.

TL;DR

# clear the texts on the terminal
clear

For example, let's say we have already executed some commands in the terminal like mkdir hello, ls, and echo "Hello World".

And terminal is filled with the output texts of the executed commands like this,

~/Desktop
❯ mkdir hello

~/Desktop
❯ ls
hello
curl.txt

~/Desktop
❯ echo "Hello World"
Hello World

Now to clear the terminal, we can execute the clear command like this,

# clear the texts on the terminal
clear

After executing the above commands, the terminal will be cleared and more space will be available for the user.

When executing the clear command, the contents are not essentially cleared but the executed commands output texts are shifted above the terminal cursor.

That's all 😃.