Linux clear command tutorial

Linux clear command

It's quite uncomfortable when working in the Linux command line terminal which is full of text and you have to type command at the command prompt at the bottom of the screen. There is a command in Linux that can wipe the screen clean. The Linux clear command can be used to remove all commands or texts in the command line terminal.

Let's check the Linux clear command manual page and see what else it can do. Type man clear at the Linux terminal command prompt:

[email protected]:~$ man clear

This is the result:

clear - clear the terminal screen


clear clears your screen if this is possible. It looks in the environ‐
ment for the terminal type and then in the terminfo database to figure
out how to clear the screen.

clear ignores any command-line parameters that may be present.

tput(1), terminfo(5)

This describes ncurses version 5.6 (patch 20071124).

Believe it or not, that's the only text we have for Linux clear command manual page. That means the clear command just meant to do that, clear the screen. Here's an example on how Linux clear command works:

Type clear at the command prompt to clear the screen.

Using /etc/random-seed to initialize /dev/urandom.
INIT: Entering runlevel: 3
Going multiuser...
Starting sysklogd daemons: /usr/sbin/syslogd /usr/sbin/klogd -c 3 -x
Activating hardware detection: /etc/rc.d/rc.hotplug start
Starting Internet super-server daemon: /usr/sbin/inetd
Starting OpenSSH SSH daemon: /usr/sbin/sshd
Updating shared library links: /sbin/ldconfig
Updating X font indexes: /usr/X11R6/bin/fc-cache
Starting sendmail MTA daemon: /usr/sbin/sendmail -L sm-mta -bd -q25m
Starting sendmail MSP queue runner: /usr/sbin/sendmail -L sm-msp-queue -Ac -q2m
Starting gpm: /usr/sbin/gpm -m /dev/mouse -t imps2
gpm: oops() invoked from gpm.c(977)
/dev/mouse: No such device

Welcome to Linux (tty1)

slackware login: bill
Last login: Sun Jun 21 11:42:55 +0800 2009 on tty4.
No mail.
[email protected]:~$ clear

When we enter the clear command, all texts on the current screen will be gone. You can see the command prompt now is at the top of the screen again. That's it. It's a very simple command yet very useful.

Back to Linux basic commands main page.

Add new comment