While most of us use the `clear` command to clear a Linux, macOS, or Unix terminal screen, you can actually do this much faster by pressing `Ctrl + L` keyboard shortcut keys. Try it!
@nixCraft How do you know it's most of us?
@nixCraft I love that shortcut, sometimes I accidentally press super + L, locking my machine ...
@nixCraft I use that ALL THE TIME. In fact I never use clear, only CTRL+L for the general case in which you want to clear the screen, and `reset` command if the terminal gets borked.
@nixCraft there are moments when u must use "reset" command, especially after connecting to serial consoles.
@madalinignisca @nixCraft It used to be years between I needed ”reset”, but after the latest update to docker compose, I need it all the time on my RPIs, if I forget to include the ”—ansi never” option.
@odd @nixCraft for me it happens on almost all network devices and servers management ports
@nixCraft in many terminals it actually have different functions. Clear removes all commands backlog in current session, while ctrl+L just hides them (i.e. you can scroll up to see it)
@nixCraft This works because <ctrl>L is the 'form feed' character in ASCII

@lemgandi

Surprisingly, to those of us who grew up with home computers, that's not truly the case.

https://unix.stackexchange.com/a/593613/5132

#terminals #FormFeed #EraseDisplay #ECMA48

How to shift previous output upwards on Konsole

On gnome-terminal I'm used to type clear or ctrl+L to clear the terminal and I can still scroll back to view all previous outputs. On konsole - KDE, running the clear command removes the outputs on...

Unix & Linux Stack Exchange

@JdeBP

I date from the era of paper terminals, but this was really interesting. I Am Enlightened!

@nixCraft when in doubt type "stty sane"+enter beforehand
@nixCraft additionally it selects address bar in browsers.
@nixCraft Interesting - on my Mac I'm used to `CMD + K` for some reasons. It's easier on my fingers, as the `ctrl` key is mostly out of reach for happy reach without having to move my whole hand.
@ligasser @nixCraft Command-K also clears the scrollback buffer on Mac Terminal and iTerm2, so it's doubly good.
@rantingnerd @nixCraft true, in fact I use that to run commands which produce thousands of lines of errors, and jump to the top, where it usually starts!

@nixCraft

I was fortunate enough to learn the Control L shortcut way in the beginning of the alpha versions of Linux, when distributions were not even a figment of the imagination.

It has saved me hundreds of thousands of keystrokes

#sh #csh #ksh #zsh #ash #bash #programming #OpenSource #technology #Linux

@nixCraft I’m not sure if macOS users use `Ctrl+L`. It seems like they might be more likely to use `Cmd+K`, since the `Ctrl` key is far, far away from left hand thumb 🙃

Image credits: https://iboysoft.com

@nixCraft it's especially great since you can use it in the middle of typing your next command.
@nixCraft For once, I'm way ahead of you on this one. :D

@nixCraft here some useful shortcuts
ctrl + E = moving cursor to the end of the line

ctrl + A = moving cursor to the beginning of the line