Little shortcuts that think of stuff like this without any configuration (iTerms is impressively extensive) are just a cherry on top. It kind of bums me out that's not linux native. Do you know of any other useful shortcuts specific to macOS? I've been using ctrl+L for the longest time. Thank you for sharing!
Actually, I've been using Terminal for years. I usually try to use default apps as much as possible (Safari, Mail, Notes, Terminal) to reduce configuration overhead. I switched to iTerm2 a few days ago after reading an article on HN... not sure if it worth the change, but haven't tried anything fancy yet. What would be the killer feature of iTerm2?
https://www.marcjenkins.co.uk/drop-down-terminal-with-iterm2...
As for shortcuts — ctrl-K (kill line), ctrl-A (go to start of line), ctrl-E (end of line) are my bread and butter, and work with most shells.
Plus, Terminal.app feels much faster. Using terminal Emacs feels very different in the two terminals.
I recently switched back to Terminal from iTerm, and was amazed by the speed increase.
When entering commands, it is visibly a little "snappier." But where it really shines is in the output.
I have a few of batch processes that I have to run once a week, and they're all pretty heavy on the debug output, with lots of VT100 eye candy. One process that used to take close to six hours in iTerm got significantly shaved when I switched to Terminal.
Since I only run this once a week, I haven't had a chance to benchmark it, but my guess is that Terminal shaved 40 minutes off the job.
The only thing I miss from iTerm is having two sessions open in a single window. I suspect this is possible in Terminal, but I haven't figured it out yet. When I click the "Split Pane" button, I get two panes of the same session, instead of a new session in the new pane.
That typo has a nice program of its own: https://github.com/p-e-w/ternimal
EDIT: On my windows machine I think it is ALT+F8 in Git Bash. May be similar in other terminal emulators.
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.
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.
ED 3 isn't actually in the [ECMA-048] spec.
It was an xterm feature introduced in June 1999. Several terminal developers later adopted the feature. In April 2011, a Red Hat developer submitted a patch to the Linux kernel, modifying its console driver to do the same thing.
So it's not a formal standard, but it's universal on Linux since 3.0 and many terminal emulators have adopted it.
This history is covered in [clear(1)] from the ncurses project.
[ECMA-48]: http://www.ecma-international.org/publications/files/ECMA-ST...
[clear(1)]: http://man7.org/linux/man-pages/man1/clear.1.html#HISTORY
EDIT: Fix wording and formatting.
* https://unix.stackexchange.com/a/375784/5132
* http://jdebp.uk./Softwares/nosh/guide/commands/setterm.xml
clear && make testCtrl + l is in Bash, in your case.
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).
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.
printf \\33c
Another way is to use a program that converts hex to binary. A short script to use when there is no clear, tput, etc, e.g., xxd or nc-data exec echo 1b63 |exec xxd -p -r
echo -e '27\n99\n' |exec nc-data -g
exec echo |exec sed '1i\
27 \
99
' |exec nc-data -g/ is a forward slash, a.k.a. simply “slash”
Probably better to just use "escape" for backslash and "slash" for forward slash.
Sounds like your terminal clears everything? vt100 variants are a, uh, delightful mix of nearly-compatible dialects...
The command "tput clear" should work everywhere though. And frankly, while obviously more work than a keyboard shortcut, it's not that much of an effort.
$ clear; printf '\e[3J'
(edit: whoops wrong URL, sorry https://apple.stackexchange.com/a/113168 )I think this needs a solution -- a keymapping and a function that resets the terminal need to be consciously united.
actually, I think I need a full set of keystrokes for linux. Somehow on ubuntu pressing the command key leads to all the windows rearranging like expose on mac.
sigh.
However I found out that most terminal emus on Linux also have this feature as Ctrl-L.
In gnome-terminal you have to press Ctrl-K to clear the screen, and then Ctrl-L to redraw the prompt.
The bash manual documents Ctrl-L as "Clear the screen leaving the current line at the top of the screen."
Also, from `man bash`...
> clear-screen (C-l) Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen.
It's too bad it's so slow though (in terms of throughput, that is; latency is pretty okay).