Linux : clear command and its keyboard shortcut

Today, in this post we will explain about linux clear command and its keyboard shortcut. Like cls command on Windows, on linux we use clear command.clear command is available on all Unix like Operating System.

clear command clears output and command on console or terminal window. In short words, clear command clear the screen. But it does not mean all commands are removed from history, it just clearing the screen. If you scroll back on same terminal(use key combination Shift + PageUP), you can see the previous outputs. It has just clear the screen of visible terminal windows of your system.

Note: clear command do not have any arguments.

How to use clear command

It is very simple command with no arguments. Only execute the below given command

clear

Have a look on below given example of clear commad (gif image)

clear command

clear command keyboard shortcut

Every time you would not like to type on terminal. Most of system administrator prefer to use keyboard shortcuts.

On bash shell, the below given are clear command keyboard shortcut

1. Combination of CTRL with l (Lowercase L)

Press the keyboard with combination of CTRL and l (lowercase) key, it is similar to screen clear command.

2. Combination of CTRL with 7 (digit)

In case you want to clear only line, use combination of CTRL and 7 key from system’s keyboard.

In below given example, I type df -h and then pressed CTRL with 7 key. It cleared only that line. See below given screencast

clear-2

3. Combination of CTRL with L (Uppercase)

In case, we want to clear all output from terminal except the current line we are on. Use the combination of keys CTRL with L (uppercase)

See the below given screencast, at df -Th command I used this keyboard shortcut

clear command

1 thought on “Linux : clear command and its keyboard shortcut”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.