Commands to Clear Terminal Screen

4 Commands to Clear Terminal Screen in Linux

Has it ever happened to you that you get so engrossed in working with your Linux terminal environment that you are suddenly shocked to encounter a busy screen full of various commands and get confused by viewing the crowded terminal environment?

Most likely, all Linux users who do their tasks in the terminal environment have experienced this situation, and probably the option they chose to get rid of the terminal screen full of commands was to restart the Linux system? isn’t it?

Of course, users who have chosen the popular Linux operating system for many years for various purposes are familiar with the useful Linux commands, but users who are new to using the Linux operating system may use complicated methods to solve their problems due to unawareness. They still don’t know that Linux is full of surprises and excitement, and you can easily manage the Linux operating system by knowing its helpful commands.

Naturally, when working in a terminal environment filled with many commands and their output, no one can focus on the next task, and sometimes you need to tidy up the screen and the terminal environment in Linux to better focus on your other tasks. There are various commands to clear the terminal screen in Linux, which will save you from restarting the Linux operating system.

Managing Linux by running different commands for different purposes is much easier than you think. In addition to commands, you can also use useful tools to improve Linux system management. For example, by installing and using Screen in Linux, you can simultaneously Use multiple virtual sessions resulting from sharing a terminal environment to perform multiple tasks and manage your various tasks simultaneously.

If you have chosen Linux VPS for your purposes and are looking for a simple way to clear the terminal screen in Linux, you have chosen the right article because in this article we will provide different commands to clear the terminal screen in Linux.

If you have chosen Linux VPS for your purposes and are looking for a simple way to clear the terminal screen in Linux, you have chosen the right article because in this article we will provide different commands to clear the terminal screen in Linux.

1. Clearing the terminal using the clear command

The easiest way to clear the terminal screen in Linux is to run theclearcommand:


By running theClearcommand without arguments, a busy screen full of commands in the Linux terminal environment turns into a blank-slate screen, and you will no longer have access to the history of previous commands and their output.

It should be noted that running the Clear command according to your terminal emulator (a terminal program for accessing the command line) has a different function, that is, in emulators such as Putty, it does not clear all pages containing commands and By using the PageUp and PageDown keys or mouse navigation, you may be able to access the commands you have already executed and their output. But in the GNOME Terminal Emulator on Ubuntu, the Clear command will clear all pages containing commands.

As we explained, the Clear command completely clears your terminal screen, you won’t even be able to use the scrollback buffer option anymore. If you don’t want the scrollback buffer option to be deleted when you clear the Linux terminal screen, you can use the following command:

clear -x

By running the clear -x command, if you scroll up with the mouse or Use the Page Up key on the keyboard to scroll up, you may see the output of the previous commands; because this command directs the previous commands upwards and provides a new clean terminal screen to the users. the clear -x command allows users to access the desired output if they need the output of the previous commands while they are enjoying a clean screen.

As a result, remember that the Clear command does not change the shell state and does not reset the entire terminal.

How to clear the KDE terminal using the clear command

If you want to use the clear command in the KDE terminal to clear the terminal screen, you should enter the following command:

clear && echo -en"\e[3J"

2. Clearing the screen using the reset command

By typing the reset command, everything in the terminal environment is cleared and returns to the initial default settings. If we want to explain more, the output of the reset command will be accompanied by disabling echo and raw modes, reinstalling covers tab extensions, and enabling newline translation. Therefore, to restart the terminal with default settings, you can run the following command:


Executing the reset command is useful when the terminal environment needs to be reinstalled and you intend to use the standard terminal settings. You may hang on a little after running the Reset command while running the clear command will clear the terminal environment quickly.

Note: In addition to the reset command, thetput resetcommand also restarts your terminal environment and has the same function as the reset command.

3. Clearing the terminal using the command printf “\033c”

To restart the terminal screen and clear the terminal commands, you can use theprintf "\033c"command, which replaces theClearandrestartcommands. Therefore, the command you will run to clear the Linux terminal is as follows:

printf "\033c"

You can use the alias for a command instead of typing numbers, for example, if you consider x as an alias for printf “\033c”, you should type the following command:

alias x='printf "\033c"'

You can replace the printf “\033c” command with theprintf "\ec"andprintf "\x1bc"commands, Through these commands, you can clear the buffer and screen of the terminal. Fortunately, these commands can be used in gnome-terminal and xterm.

How to use the alias command in KDE

To clear the KDE terminal environment (Konsole) and scroll-back buffer, if you want to use the alias command, you must enter the following command:

alias cls='clear && echo -en "\e[3J"'

4. Clearing the terminal using a shortcut key

In addition to executing commands to clear the terminal screen of executed commands and their output, you can use shortcut keys. shortcuts are the fastest method to clear the terminal in Linux, and they vary according to your terminal emulator.

To achieve the result of running Linux commands to clear and reset the terminal, such as the command clear -xin GNOME, you can use the shortcut “Ctrl + l“. your terminal will be completely sorted and cleared by using Ctrl + l shortcut, but the scrollback buffer will not be deleted. It’s worth mentioning, this command provides access to previous commands and outputs by scrolling the mouse up and using the Page Up button on the keyboard.

In other terminal emulators, if the Ctrl + l shortcut key is not work, you can use the shortcut key Ctrl + Shift + K instead of Ctrl + l.

It should be noted that you can set a shortcut key by referring to Edit → Keyboard Shortcuts in the GNOME terminal even for Reset and Clear your terminal screen and clear the terminal screen using the shortcut key you want.

How to clear the KDE terminal using a shortcut

When  KDE is dealing with Yakauke nv, you can use the ctrl + shift + k  shortcut to clear the KDE terminal.


The most common key shortcut in GNOME Terminal and other terminal emulators is Ctrl + L, but if this key shortcut doesn't work, you can try Ctrl + Shift + Key shortcut.

To clear the entire bash history, thehistory -ccommand is executed from the command line in Ubuntu. You can also useunset HISTFILE to clear the terminal history.


In this article, you learned different commands to clear and organize the terminal in Linux, and you got rid of restarting the Linux system to remove the terminal from the previous commands. This article has somewhat introduced you to the advanced and wonderful world of Linux, but familiarity with comprehensive Linux commands is essential for all Linux users, especially beginners so that they can implement the most efficient methods for better management of the Linux operating system and solve their problems easily. We are glad that you chose our article to read and we hope you got what you needed in reading this article.

Leave a Reply

Your email address will not be published. Required fields are marked.