5 ms·
I am currently using Fedora 31 Cinnamon which uses GNOME Terminal and the shortcut to reset and clear screen/scrollback is CTRL+L. I am not sure if this shortcu
by capn_cabbage 7y ago
I am currently using Fedora 31 Cinnamon which uses GNOME Terminal and the shortcut to reset and clear screen/scrollback is CTRL+L. I am not sure if this shortcut is standard on GNOME Terminal or not, but it's present in this flavor.
EDIT: On my windows machine I think it is ALT+F8 in Git Bash. May be similar in other terminal emulators.
- microcolonel 7y agoIt's actually an Emacs keybinding, that was added to GNU readline, which is used by Bash; most shells followed suit (either by using readline, or implementing it themselves). Ctrl + l is in Bash, in your case.
- LukeShu 7y agoWhile many of the readline keybindings come from Emacs, I would have said the common shell handling of Ctrl-L comes from that ^L is ASCII form-feed, which is "clear the page; start a new page" (in the same way that ^H is ASCII backspace). I hadn't considered Bash C-L to be the same as Emacs C-L, since in Emacs I can hit C-L again to "undo" it (kinda).
- OrderlyTiamat 7y agoC-l doesn't clear anything in it's default behavior right? It changes the line-at-poit to be at the center of the screen, bottom, or top, depending on how often yoi press it. I would never have associated that with screen clear. E: excuse me, of course C-l does the same scrolling in the terminal, it doesn't clear the history of course.
- jerf 7y agoCTRL-l is a standard "clear the screen" keystroke, and should work in all terminals, but it does not necessarily clear the scrollback buffer. Since "scrollback" is something implemented by the emulator itself, you'll have to look up how to do it there. I use konsole, and it's CTRL-SHIFT-k there by default, I believe. I just ran gnome-terminal, and I see in Edit -> Preferences -> Terminal -> Reset and Clear that you can give it a shortcut key but it does not appear to ship with one configured by default.
- capn_cabbage 7y agoI may have changed the key binding after installation. It has been a while so it feels like it has always been that way.
- djsumdog 7y agoThe reset command should clear the scrollback buffer. On older terminals where you'd get a garbled screen if you accidentally cat a binary file, it will give you your ASCII back.
- swiley 7y agoReset takes at least a couple seconds though, I’m not sure I’d swap it with clear in something like: clear && make test
- jerf 7y agoTrying it just now on konsole, it does not. Whether that's because your terminal is following standards or because your terminal is interpreting a terminal command that doesn't actually say anything about scrollback to also clear scrollback, I don't know, and await anyone who does to answer that question. My gut is that the terminal protocol would know nothing about scrollback and thus not have a "clear scrollback" command in it directly. There are plenty of other indications that scrollback is basically a hack.
- scrollaway 7y agoTried it on konsole 19.12.2 (on Arch), it works for me.
- gerdesj 7y ago[Konsole] Settings -> Configure Keyboard Shortcuts ... "Clear Scrollback and Reset". On my Arch boxes it is mapped to Ctrl + Shift + k. That's probably a default from upstream.
- JdeBP 7y agoYour "gut" is wrong. It's ED 3.