Sometimes it is necessary to clear the terminal window of the text to get started, so to speak, from scratch. Consider 5 different ways to clear the terminal.
The clear command clears the terminal window. In fact, the output of the previous commands in the terminal is not deleted, just the command line is moved to the first line of the terminal, and under it you get a clean space.
The easiest command to remember
The reset command is used to return the terminal to its original state.
For example, if after executing a program you try to enter a command in the terminal, but not the characters you press are entered. In this case, the reset command will restore the terminal to its original state. Also, after executing this command, the terminal window is cleared.
One of the quickest and easiest ways to clear a terminal is to press Ctrl+L.
The Ctrl+L action is similar to the clear command.
If you run the clear command once, the terminal window will be cleared, but if there was a lot of text in it before, you can use the scroll and view this text. If you run the clear command again, the previous output in the terminal window is cleared. To avoid typing clear twice, you can run:
clear && clear
If you run the printf "\033c" command in the terminal, the terminal window is cleared.
Code 033 (octal notation) corresponds to the ASCII code of the Esc-sequence. Entering the Esc-sequence +c in the terminal resets the terminal to its original state (similar to the reset command).
May the Force be with you,