Use the following command to get a clear terminal screen. The following commands are handy and provide very easy-to-use options and/or shortcuts.
Clear – clean terminal screen
Clear the terminal when it is overloaded with commands or information by using the “clear” command-
clear
BashThere is a shortcut/hotkey for this-
CTRL + L
Bash** This does not remove or delete the output from the screen. It just move the outputs above, so that we can see a clean screen.
** You can still scroll up and see the previous output.
Reset – terminal initialization
Use the reset command to clear all the output from the terminal-
reset
BashThis will remove all output from the terminal. We will not be able to scroll up and see the out.
The terminal will be as fresh as new.
** this will not do anything to the command history, just the output from the terminal will be clean.
CTRL + U – clear everything on the left
Use the following hotkey to clear everything from the left of the cursor-
CTRL + U
BashExample:
$ some command here
# Say the curor is at the end
# then press CTRL + U
# The line will be cleard
$
BashAnother example-
$ Something wrong ls -la
# Say the cursor is before "ls"
# and you press CTRL + U
# then the text before "ls" will be deleted
# and you will get result as below
$ ls -la
BashCTRL + K – clear everything on the right
Use the following hotkey to clear everything from the right of the cursor-
CTRL + K
BashExample:
$ ls -la some extra params
# Say the cursor is before "some ...."
# and you press CTRL + K
# then the text from "some...." will be deleted
# and you will get result as below
$ ls -la
Bash