Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"CLS" Equivalent in BASH?

Tags:

bash

terminal

How do you clear the entire terminal in BASH, like the command prompt's cls command?

clear doesn't work because it doesn't actually clear anything, it just scrolls down.

like image 536
user541686 Avatar asked Jun 16 '11 04:06

user541686


People also ask

What is CLS in bash?

cls is a clear screen command for Windows Command Prompt (MS-DOS)

How do I clear the screen in bash?

When using the bash shell, you can also clear the screen by pressing Ctrl + L .

What is CLS in command line?

MS-DOS and Windows command line cls command The cls command allows users to clear all the contents on the screen and leave only a prompt.


2 Answers

As far as I know, there isn't a way to do this any better than what clear does with bash.

I think it's a feature that could be built into the terminal you're using though. I know the Mac Terminal app has a 'Clear Scrollback' menu option (command + k) that does what you're asking for.

like image 109
DouglasHeriot Avatar answered Oct 21 '22 23:10

DouglasHeriot


Why don't you try Ctrl+l (control, lowercase "L"). This works in most shells (err terminals)...

In OSX terminal -

Command ⌘+l (command, l) leads to removing last typed command from display.

Command ⌘+k (command, k) leads to removing/clearing all display buffer.

reset (type this in terminal) leads to reset of terminal in case display becomes garbled.

not sure of equivalent in other unix flavors.

like image 36
Srikar Appalaraju Avatar answered Oct 22 '22 01:10

Srikar Appalaraju