Table of contents

Really clear termial in Linux/Unix

Linux Sep 29, 2020 Viewed 62 Comments 0

Issue

In windows command prompt, we can use cls to clear screen. But this is not available on Linux or Mac.

Solution

We can type the following command:

printf '\33c\e[3J'

For curious, this part '\e[3J' is a terminal escape command.

We can define an alias in the file of .bashrc and .zshrc.

alias cls="printf '\33c\e[3J'"

And run.

source ~/.bashrc
Updated Sep 29, 2020