Home > Environment & Utility > clear

clear: Clear Terminal Screen

The clear command clears the terminal screen and moves the cursor to the top. It is useful for tidying up a cluttered screen with complex output and is included by default on most Linux systems.

Overview

The clear command clears all content displayed on the current terminal screen and moves the cursor to the top-left corner of the screen. This is useful for keeping the terminal session clean and starting new tasks.

Key Features

  • Clears the entire terminal screen
  • Moves the cursor to the top of the screen
  • Cleans up the screen after complex output

Key Options

The clear command is typically used without options, but there are a few useful options for specific situations.

Behavior Control

Generated command:

Try combining the commands.

Description:

`clear` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Common ways to use the clear command.

Basic Screen Clear

clear

Clears all content on the current terminal screen and moves the cursor to the top.

Clear Screen While Keeping Scrollback Buffer

clear -x

Clears only the visible screen, preserving the previous content in the terminal's scrollback buffer.

Tips & Notes

Tips for using the clear command more effectively.

Ctrl+L Shortcut

  • Description: In most terminals, the `Ctrl+L` key combination performs the same function as the `clear` command, clearing the current screen. This allows for faster and more convenient screen clearing.

Understanding Scrollback Buffer

  • Description: The standard `clear` command often clears the terminal's scrollback buffer as well. If you want to view previous output again, use `clear -x` or configure your terminal emulator settings to not clear the scrollback buffer.

Same category commands