5 Commands to Clear Linux Terminal

Last updated: June 27, 2022

Sometimes, as you go about running commands on a Linux terminal, you may feel that the terminal is somewhat 'filled up' with commands and outputs of those commands. Therefore, you may want to clear the terminal to declutter it and continue from the top once more.

In this guide, we are going to outline how you can clear the Linux terminal.

1. clear command

Let's assume that your terminal is full of commands and output as shown below

terminal with full of commands

Run the clear at the bottom of the terminal prompt.

Results

The terminal screen gets cleared as shown below

clear the Linux terminal

2. reset command

Just as in the example above, you need to run reset command at the bottom of the terminal to clear the screen as shown.

reset the Linux terminal

Results

As shown below, the terminal has been re-initialized by the reset command.

clear the Linux terminal

There's also the tput reset command which will also do the trick.

3. Using the Ctrl + L shortcut

Another Handy method of clearing the terminal is the use of Ctrl+L keyboard shortcut. It will have the same effect as the clear or reset command.

4. Using the printf “\033c” command

Another method one can use is by typing printf "\033c" on the terminal prompt and hitting enter. This will also have the same effect of reinitilaizing the screen.
This can also be defined as an alias through

alias cls='printf "\033c"'

5. Clearing the Linux terminal for KDE

For a KDE terminal also referred to as Konsole, the following command comes in handy

clear && echo -en "\e[3J"

This can also be aliased as shown

alias cls='clear && echo -en "\e[3J"'

Furthermore, you can use the keyboard shortcut when dealing with Yakauke

ctrl + shift + k

Note:

When using the above-mentioned methods to clear the screen, you'll notice that the screen (putty) is still scrollable. That is one call still scroll up using a mouse or cursor up key to the previous commands and their output. If you want to clear the screen without a scrollback use the command clear && clear:

clear && clear

Conclusion

In this guide, we learned how you can clear the Linux terminal. you are welcome to try out the commands outlined and provide feedback. Thank you.

About The Author

James Kiarie

James Kiarie

James is a certified LPIC Linux administrator and passionate Linux technical writer. He has over 4 years of penning down technical guides in Linux administration with ample experience in a range of distributions such as Ubuntu, CentOS, RHEL, Fedora, Rocky, and AlmaLinux to mention a few. In addition, he has also spread his wings wider to cloud computing and DevOps tools such as Terraform, Docker, and Kubernetes. During his free time, I love swimming, listening to music, reading books, and taking evening runs after a busy day.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment