4 Useful Commands to Clear Linux Terminal Screen


Just like any other operating system, Linux also supports a rich Graphical User interface (GUI). In fact, it supports multiple graphical desktop environments such as – GNOME, KDE, Cinnamon, and the list goes on.

However, most Linux administrators and power users prefer to use the command line interface, because it allows us to automate repetitive tasks using the scripts.

One of the trivial downsides of this approach is that often times the terminal gets filled up with the command’s or script’s output. So, in some cases, cleaning up the terminal becomes necessary.

In this guide, we will discuss various methods that allow us to clean up the Linux terminal. After following this guide, Linux users can use one of the methods while working with Linux’s command line interface.

1. Clear Linux Terminal Using clear Command

The clear command is one of the most commonly used commands for clearing the Linux terminal. This command simply clears the terminal screen including its scroll-back buffers.

To understand the usage of the command, let’s execute a few commands in the terminal:

$ echo "Hello, World!"
$ cat /etc/os-release

Now, to clean up the screen, just execute the clear command without any argument:

$ clear
Clear Linux Terminal
Clear Linux Terminal

2. Clear Linux Terminal Screen Using CTRL+L Shortcut

In a similar way, we can use the ctrl+L shortcut to clear the terminal screen. However, this method doesn’t clean up the scroll-back buffers.

To illustrate this, first clear the terminal screen using the ctrl+L shortcut and then scroll up the screen using the mouse:

Clear Terminal Using CTRL+L Shortcut
Clear Terminal Using CTRL+L Shortcut

In this example, we can see the previous output by scrolling up the terminal.

3. Reset (Clear) Linux Terminal Using reset Command

Additionally, we can also use the reset command to clear the terminal screen. Just like the clear command the reset command also clears the scroll-back buffers.

The reset command reinitializes the terminal hence it takes more time compared to the clear command.

$ reset
Reset Linux Terminal Screen
Reset Linux Terminal Screen

4. Clear the Terminal Using the Escape Code

We can use the <ESC>c escape code to clear the terminal. Let’s understand with a simple example.

In bash, we can use the \e escape sequence to represent the ESC character. So, to clear the terminal screen we can use the \ec string with the printf command as shown below:

$ printf "\ec"

In a similar way, we can use the \033 octal number to represent the ESC character. So to clear the terminal, we can use the \033c string with the printf command:

$ printf "3c"

In addition to this, the hexadecimal number \x1B represents the ESC character. Hence we can use it to clear the screen:

$ printf "\x1Bc"

In this guide, we discussed various methods for clearing the Linux terminal screen. Linux users can use one of the methods as per their choice.

Do you know of any other method for clearing the terminal in Linux? Let us know your views in the comments below.

If You Appreciate What We Do Here On Jassweb, You Should Consider:

Jassweb is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit Jassweb! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?