FactorPad
Faster Learning Tutorials

Linux clear command summary with examples

clear allows you to clear the terminal screen.
  1. Purpose - Learn what clear is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with clear.
  4. A tip - Finish off with one more insight.
Paul Alan Davis, CFA, October 4, 2016
Updated: July 25, 2018
In this tutorial, 3 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Next

~/ home  / tech  / linux essentials  / clear command


The Linux clear command

Beginner

Learn to erase the terminal screen at the Linux command line.

Video Tutorial

Linux clear command summary with examples (3:17)

Videos can also be accessed from the YouTube Playlist.

Video Script

The Command and Why You Need It

Our third word, or command to memorize is clear from the category Navigation.

clear allows you to clear the terminal screen. Recall from our last video, our terminal screen got a little messy as we printed help files using the whatis command. Well, clear will help us here.

If it helps, think of commands as mini programs and most have this structure. First, type the command, second the option(s) and third the argument(s).

The clear command interestingly has no options and no arguments. Its one purpose is to clear the screen. In the terminal you shouldn't expect things to look pretty; quite the opposite actually. But every once in a while you need to change gears and clear the clutter, and to do so type clear and Enter.

So why is clear an important command? Well, it's the essential command to keep your terminal window tidy. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows 10.

Here we go, let's borrow a command from the previous video and fill up our screen, type whatis -h with no arguments, Enter and look, the 13 available options for the whatis command.

$ whatis -h Usage: whatis [OPTION...] KEYWORD... -d, --debug emit debugging messages -v, --verbose print verbose warnings messages -r, --regex interpret each keyword as a regex -w, --wildcard the keyword(s) contain wildcards -l, --long do not trim output to terminal width -C, --config-file=FILE use this user configuration file -L, --locale=LOCALE define the locale for this search -m, --systems=SYSTEM use manual pages from other systems -M, --manpath=PATH set search path for manual pages to PATH -s, --sections=LIST, --section=LIST search only these sections (colon-separated) -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. $ clear

Next, to clear the screen type clear Enter and there you go.

$ _

A Final Tip

Okay now you know how to use clear. And you know the syntax for commands, options and arguments.

One last tip about the clear command. We'll talk more about aesthetics later, for example, your command prompt may not look as simple as mine so I'll show you how to customize this later.

Okay, thanks for visiting today. I hope this was a fun introduction to the clear command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

First off, subscribe so you don't miss our latest videos.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the whatis command, hit Back.
  • To learn command #4 man, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / clear command



 
 
Keywords:
linux clear command
clear linux
unix clear
linux clear screen
clear linux screen
linux erase screen
linux clear command tutorial
terminal clear
clear terminal screen
clear console
shell clear screen
clearn linux
linux erase screen