clear Command in Linux

This tutorial explains Linux “clear” command, options and its usage with examples.

clear – Clears the screen.

DESCRIPTION

The `clear` command is one of the most handy commands to know if you are a command line user in Linux. As you are moving through directories, `cat`ing files, or any number of standard tasks, your terminal will get filled up with a bunch of prior commands and output. If you want to start from a blank slate, but don’t want to log out and log back in, then using `clear` will become a handy tool.

The clear command is used to remove all previous commands and output from consoles and terminal windows in Unix-like operating systems.

Clear is one of the very few commands in Unix-like operating systems that accepts neither options nor arguments (i.e., input files).

advertisement
advertisement

In Unix-like operating systems there are often multiple ways of performing the same task:

For example, the same result as using the clear command can be achieved in the bash shell by simultaneously pressing the CONTROL and l (lower case L) keys.

The bash shell also allows a single line to be cleared by simultaneously pressing the CONTROL and 7 (number seven) keys.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

In addition, everything except the current line can be removed by simultaneously pressing the CONTROL and L (upper case L) keys.

SYNOPSIS

clear

advertisement

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.