How to Clear Terminal Screen in Linux

Photo of author

By Oluwaseun Bamisile

Published

Do you wish to clear everything on the terminal screen in Linux instantly? Read this guide to learn the numerous ways you can do it.

Option 1: Clear Terminal Screen with the Clear Command

The most common and one of the fastest ways to clear the terminal screen in Linux is to use the clear command. All you have to do is input the command below and press the enter key on your keyboard.

clear

Executing the aforementioned command erases everything on the terminal screen, including the scrollback buffer. In case you are wondering, the scrollback buffer contains data or text that has scrolled off a display and is no longer visible.

In this context, the scrollback buffer features previous texts, commands, and outputs that have been scrolled off the terminal screen. Therefore, if you wish to access the scrollback buffer, you can simply scroll up or use the Pg Up key.

Meanwhile, if you want to erase your Linux terminal screen, excluding the scrollback buffer, you have to add the “-x” argument with the clear command. Below is what the command should look like after adding the “-x” argument.

clear -x
Clear Terminal Screen In Linux With Clear Command

Option 2: Clear Terminal Screen Using the Reset Command

Interestingly, apart from the clear command, you can also use the reset command to clear the terminal screen in Linux. However, unlike the clear command, the reset command reinitializes the terminal and restores it to the default settings. 

To make use of the reset command to clear the terminal screen in Linux, input the command below and press the enter key.

reset
Executing the reset command takes a few moments to complete, unlike the clear command, which takes effect instantly.
Clear Terminal Screen In Linux Using Reset Command

Option 3: Clear Terminal Screen with Keyboard Shortcut

Do you know that there is a keyboard shortcut to clear the terminal screen in Linux? Well, if you press the Ctrl + L keys on your keyboard simultaneously, it automatically erases everything on the terminal screen.

The Ctrl + L keyboard shortcut works just as the clear -x command. Basically, it erases everything on the terminal screen, excluding the scrollback buffer.
Clear Terminal Screen In Linux With Keyboard Shortcut

Option 4: Clear Terminal Screen Using an Alias

Interestingly, you can use an alias to clear the terminal screen in Linux. For your information, an alias in Linux is a shortcut for an original command.

Therefore, you can create an alias for the actual commands used to erase the terminal screen in Linux. What this means is that even though the clear and reset commands are pretty simple, you can create simpler commands for them.

To create an alias in a Linux terminal, input the subsequent command below and press the enter key. However, replace “new command” with your preferred alias and “actual command” with the original command.

alias new command='actual command'

For example, if I want to set “x” as the alias for the “clear” command, below is what the command will look like.

alias x='clear'
Clear Terminal Screen In Linux Using An Alias

After creating an alias for an original command, the alias will execute as the original command. Therefore, if I execute “x” in my Linux terminal, it will erase the terminal screen just like the “clear” command – remember, I set “x” as the alias for the “clear” command.

The command provided in this section creates a temporary alias. Hence, if you close and reopen your Linux terminal, the alias won’t work anymore.

To create a permanent alias, you need to edit system files.

Frequently Asked Questions

1. How do you erase the terminal screen in Ubuntu?

Input “clear” and press the enter key to erase every content on the terminal screen in Ubuntu. Alternatively, you can use the Ctrl + L keyboard shortcut to erase the content on the terminal in Ubuntu.

2. Can I install Linux in Windows 10?

Yes, you can install Linux on your Windows 10 computer. To accomplish that, read How To Install Ubuntu In Windows 10.

3. What is WSL in Windows?

WSL is a compatibility layer for executing Linux natively on Windows 11, Windows Server 2019, Windows 10, and Windows Server 2022. By the way, the full form for WSL is Windows Subsystem for Linux.

4. Is Ubuntu available in the Microsoft Store?

Yes, the Ubuntu application is available on the Microsoft Store.

5. Is Ubuntu linux?

Yes, Ubuntu is a Linux-based operating system that belongs to the Debian family of Linux.

Conclusion

When working in the Linux terminal, you’ll often find that the terminal screen is filled with too many commands and outputs. Hence, you may want to clear everything on the terminal screen to focus on the next task you plan to perform.

Fortunately, this guide demonstrated multiple methods to erase the terminal screen in Linux. Specifically, we learned how to perform this task using the clear command, reset command, a keyboard shortcut, and an alias.

I hope you found the procedures provided in this guide helpful and easy to understand. If you found the procedures helpful, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.

Finally, visit our Linux how-to page to get more Linux guides.

We go the extra mile to deliver the highest quality content for our readers. Read our Content Writing, Content Review, and Anti-Plagiarism policies to learn more.

About the Author

Photo of author

Oluwaseun Bamisile

Oluwaseun is the Lead Content Editor at Itechguides.com. He holds a National Diploma in Computer Science (currently studying part-time for his Higher National Diploma). An internet geek with a love for automobiles, he writes product reviews, tech articles, and how-to guides on the site.

Related Articles

Get in Touch

If this article does not meet your expectations, kindly let us know. We have various ways you can get in touch with us:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment