Command Line

Clear The Terminal

Today’s article will be a nice and easy article, where we learn how to clear the terminal. That is, we will clear any typed text and returned information from the terminal. This will be a nice and quick article.

I am feeling like garbage today and I still need to edit the last article. Ugh… But, the show must go on!

This is what I get for not having scheduled a few articles ahead. Fortunately, I have short articles in mind. Today is a good day for just that.

It should be noted that clearing the screen doesn’t delete your scrollback history. Someone could come along and use the up arrow to see your previously typed commands. If you’re at your workstation then I guess you could consider this a privacy measure – but it certainly shouldn’t be considered much of a security measure.

So, as I said, it’ll be a short article. Let’s just jump into it…

Clear The Terminal:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Now, let’s generate some content… Run the following:

ls && uptime

That should fill up your terminal with stuff. Now, let’s clear the terminal. Type the following command:

clear

Tada!

But wait, there’s more!

Run those commands again. This time, and this appears to be pretty universal, just use your keyboard and press CTRL + L.

See? It does the same thing as you get when you type clear. Those are two ways for you to use when you want to clear the terminal.

Closure:

Yup… You’ve learned how to clear the terminal. I told you that it’d be a short article. It’s even an easy article. Now I’m going to lie down and hope for a nap. 

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

View Comments

  • The difference between `clear` and CONTROL+L is that `clear` overwries the last command's exit code (`$?`) with its own, 0, whereas CONTROL+L doesn't --it is not a command, but a terminal emulator shortcut.

Recent Posts

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

2 days ago

Save A Command’s Output To A File (While Showing It In The Terminal)

The title is the best I can come up with to describe this exercise as…

4 days ago

Demystifying journalctl: A Comprehensive Guide to Linux System Logging

It was suggested that I write an article about journalctl, which seemed like a large…

6 days ago

Extract Text From Multiple File Types

Today we will have a fairly simple exercise as we're going to just use a…

1 week ago

Meta: I’ve Been At This For Three Years!

I have not done a meta article lately. I don't find them interesting to write…

1 week ago

How To: Disable CPU Cores

This is not something everyone is interested in doing but you might as well learn…

2 weeks ago