Basics

Linux clear command

Clear the visible contents of the terminal screen.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

clear [-T TYPE] [-V] [-x]

Examples

Clear the visible terminal screen.

clear

Clear the screen while leaving the scrollback buffer intact.

clear -x

Parameters, options and clauses

Option / clauseDescription
-T TYPESet the terminal type instead of using TERM.
-V, --versionDisplay the version and exit.
-xDo not attempt to clear the terminal's scrollback buffer.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory