All specs
Utility · clear

Clear

Clears the terminal screen.

Usage

clear()

Behavior

TTY → clears the screen and homes the cursor

Non-TTY (pipe, redirect, dumb terminal) → no-op (never prints raw escape codes to a pipe)

Do & don't

Do — use before a splash if you want a fully clean intro

Don't — use repeatedly during a flow (annoying); don't use to "hide errors" (still in scrollback if user scrolls)

Out of scope

Partial screen clear (lines / region)

Cursor positioning helpers