1

Due to the way Terminal clears the screen with the Ctrl + L shortcut, I'm unfortunately finding myself using other terminals for most things.

I work with logs a lot, and need to be able to quickly Ctrl + Shift + A to Select All and copy text into some other app. If I can clear the buffer, I can easily get the text I need without all the unrelated history.

Unfortunately as Terminal leaves the buffer in place when using Ctrl + L, Select All contains the entire session's history, not just the recent logs. This is a big deal with you're trying to view the last 500 lines of a command line session that has 10k lines.

I understand that Ctrl + L is just clear screen, and so also clearing the buffer might be something entirely different, but the lack of this is slowing me down. Thanks for your great work!

1

2 Answers 2

5

The reset command might be what you are looking for.

2
  • Unfortunately this doesn't work unless I'm able to enter the reset command into the terminal. For example, if running a local webserver, to enter reset I'd need to stop the server to enter the command.
    – James
    Apr 7, 2016 at 4:47
  • Can you put your task in background mode (Ctrl+Z), do reset (and eventually put it back into the foreground with fg) ?
    – lemonslice
    Nov 10, 2016 at 12:29
0

The best way IMO is to install a terminal you're already used to that already has that function. In my case, I installed gnome-terminal:

sudo apt-get install gnome-terminal

then ran these two commands to make it the default:

gsettings set org.gnome.desktop.default-applications.terminal exec gnome-terminal gsettings set org.gnome.desktop.default-applications.terminal exec-arg

Since I'm used to the cmd+k key to clear the terminal in macOS, I added Super+K (Super is the windows key) as a shortcut combination for Reset and Clear

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.