Clear command in Unix|Linux|windows with examples

In Unix, Operation System, You will run multiple commands in the terminal, and you want to clear the previous run commands on the terminal.

clear commands work in the following operating systems

  • Linux flavors
  • Unix
  • Mac
  • Ubuntu
  • Bash shell

Clear command clears the content on a terminal in Linux and Unix.

This command does not accept any arguments.

Here is a syntax

clear

It clears the current screen commands and output and shows a new prompt

Shortcut command to clear the command line in terminal windows

There are multiple shortcuts to clear command lines.

Ctrl + U - clear the terminal screen and displays a new terminal

How to cancel the current command?

The ctrl + C command cancels the current command without running and displays the same prompt screen.

In Bash Shell, You can use the Ctrl+L command used to clear the screen.

How to clear the command line in windows

CLS command in windows is used to clear the current screen terminal.

Here is a syntax and an example

C:\cls

It has no command-line options.