To clear your Terminal, use this keyboard shortcut:
- Cmd + K (Mac)
- Ctrl + K (Windows)
Alternative method: you’ll often see developers use the alternative clear
command to clear up their terminal:
clear
You can also run the keyboard shortcut: Ctrl + L instead of typing clear
and hitting Enter.
Both methods work. However, the clear
command only clears up your working window, it doesn’t remove the commands you ran, it only moves them up.
If you scroll up inside your Terminal after running clear
you’ll see that your commands are still there.
So the one you should use depends on whether you want a 100% clean Terminal or want to clear your current Terminal window space.