Clear Command in Linux with Examples
Last Updated :
09 Jun, 2023
clear is a standard Unix computer operating system command that is used to clear the terminal screen. This command first looks for a terminal type in the environment and after that, it figures out the terminfo database for how to clear the screen. And this command will ignore any command-line parameters that may be present. Also, the clear command doesn't take any argument and it is almost similar to cls command on a number of other Operating Systems.
Syntax of the `clear` command in Linux
clear
Using the `clear` command to clear the terminal in Linux.
Terminal Before Executing clear command:
clear-command-in -linux
Terminal after Executing clear command:
clear-command-in-linuxClearing our terminal using `clear -x` in Linux System
Syntax:
clear -x
Terminal before using `clear -x` in Linux
clear -x
Terminal after using `clear -x` in Linux
clear -xClear Using `CTRL + L` Shortcut in Linux System.
We can clear our terminal by using short cut `CTRL+L`.
For GNOME terminal in ubuntu 18.04 press `shift + ctrl + alt + c`.
Using `reset` command to clear our terminal in Linux System.
We can clear our terminal using the command `reset` in Linux.
Syntax:
reset
Using `\ec` command to clear our terminal in Linux System.
We can clear our terminal by using command `\ec"`
Syntax:
printf "\ec"
Where `\e` represent the ESC character and `c` is an escape sequence that is recognized by some terminal emulators to clear the screen.
This command is used in some specific terminals only.
What is the difference between `clear` and `reset` command.
The `clear` command clears the terminal screen only while when talk about `reset` command, it not only clear the screen but also resets the terminal's settings to their default values.
Conclusion
In this article we have discussed the `clear` command and different ways to clear our terminal screen in Linux. One can easily understand these commands and with no effects can clear their terminal screen anytime.
Similar Reads
apt command in linux with examples apt provides a high-level Command Line Interface (CLI) for the APT package management system, offering a user-friendly interface intended for interactive use. It simplifies common tasks like installation, upgrades, and removal, with better defaults than more specialized tools like apt-get and apt-ca
5 min read
fc-cache command in Linux with Examples The fc-cache command in Linux scans the font directories and build font cache for applications which use fontconfig for their font handling. When no arguments are passed fc-cache scans each directory for font files readable by FreeType. A cache is created which contains properties of each font and t
2 min read
df command in Linux with Examples Ever felt the chilling fear of a "disk full" error message on your Linux machine? Fear not, for the mighty df command stands ready to guide you through the treacherous terrain of disk space management! This article delves deep into the df command, equipping you with the knowledge and skills to navig
5 min read
apt-get command in Linux with Examples The command-line tool `apt-get` is the most popular package management tool used in our Debian-based Linux operating system. This article provides an overview of `apt-get` and its basic syntax. It will include the most commonly used commands, their syntax, description, and examples. It also gives an
15+ min read
yes command in Linux with Examples yes, the command in Linux is used to print a continuous output stream of a given STRING. If STRING is not mentioned then it prints 'y'; Syntax: of `yes` command in Linuxyes [STRING] Note: To stop printing please press Ctrl + C. Use of `yes` commandlet us say that we want to delete all the `.txt` fil
2 min read