The terminal is one of the most important things in Linux operating systems. The terminal provides access to the command-line interface in an easy way. Linux provides a lot of terminals that use and provide different features.
Clear Terminal with CTRL+L Keys
Linux operating systems and distributions provides different terminals. These terminals have different features and keyboard shortcuts for different actions. But most of the Linux terminals supports the “CTRL+L” key shortcut which is used to clear the terminal. This shortcut removes all content of the terminal easily.
CTRL+L
Clear Terminal with clear Command
The clear command is provided by the Linux Bash shell which is the default shell for the most of the Linux distirbutions. also other shells support the clear command. By using the shell clear command the content of the terminal can be cleared. Also the clear command is very easy to remember and very popular amongst the Linux users.
clear
More details about the clear command can be printed with the man pages and man command like below.
man clear
Clear Terminal with reset Command
Another command to clear terminal is the reset command. As its name suggests the reset command resets the terminal and clears/removes all existing content of the terminal. If the reset command is used the current history or previously executed commands are not removed.
reset
Clear Terminal with printf “\033c” Command
The printf is a special command which is used to print text and different format controllers to the terminal. Control characters have different usage where the “\033c” can be used as control characters in order to clear the terminal.
printf "\033c"
As the “\033c” is very hard to remember and type creating and using an alias for this printf command is a very practical way. Below we create an alias for this command and name this alias as “cl” which is easy to remember and type.
export alias cl = "printf '\033c'"