By accident, I just discovered something neat in the terminal emulator...

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
I checked in a few different terminal emulators and CTRL + L performs the same function as 'clear'.

I did not know this. Sure, it's probably in the help files somewhere, but it's much more enjoyable discovering this by accident. I've been at this a long time, so finding a neat shortcut like that is pretty neat. (I usually use the 'clear' function before taking screenshots for the site.)

I meant to CTRL + L to open the address bar in the browser, but I'm kinda prone and pressed the mouse button (I presume) which made the terminal take focus and it cleared the terminal. I tested again and in a few other terminal emulators and it appears fairly universal.

Alas, there's not enough meat here to turn this into an article or anything. Well, I could probably look for 'universal' keyboard shortcuts for terminals or something like that.
 


OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
Right? I've tried it in a few terminal emulators, from qps to Terminator, and it worked in all of them.

I had no idea this shortcut existed. It'll come in handy, as I do a lot with the keyboard and terminal - and I take an inordinate number of screenshots.
 
N

NorthWest

Guest
Cntl+L is part of a group of key presses in the "Miscellaneous" category of bash "emacs Editing Mode Commands" which is the default on bash. When a command line is written, basic key presses to manipulate the line include:

Cntl+A --- move to the beginning of the command line
Cntl+E --- move to the end of the command line
Cntl+K --- delete the forward-to-end of the command line
Cntl+U --- delete the backward-to-start of the command line

Another couple of commands in the "Miscellaneous" category are:
Cntl+J --- the same as pressing the return/enter key
Cntl+[ --- the same as pressing the Esc key.

Although these are part of the suite of "emacs mode" word key presses, the user can choose a "vi mode" of key presses which offer some other effects but they also include Cntl+L.
 

forester

Active Member
Joined
Mar 5, 2022
Messages
289
Reaction score
167
Credits
2,090
I like serendipitous events!
Could use it to copy URLs quickly, as well.
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
Cntl+L is part of a group of key presses in the "Miscellaneous" category of bash

I actually know some of that. I use the CTRL A and CTRL E fairly often as I reuse commands in my history. The CTRL L was entirely new to me. I was pretty darned pleased with myself when I discovered it. I felt like a great explorer stumbling across some hitherto unknown ruins! Well, not quite that excited, but still pretty pleased with learning this.
 
N

NorthWest

Guest
KGill wrote:
I was pretty darned pleased with myself when I discovered it. I felt like a great explorer stumbling across some hitherto unknown ruins!
It's refreshing to hear of such joy. In my own case when learning a bit of bash I felt myself clunking and fumbling about with it so much but wanting it to do so many different things, that I bought a book on the bash shell and pulled myself into gear, somewhat. It's nevertheless quite a mountain to climb for me, and I'm still in the foothills.
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
It's refreshing to hear of such joy.

I love the fact that I don't know everything about Linux. I am learning new things all the time.

My L-T project/site has been a great exercise that has taught me a whole lot. I like things like that. I love learning new things. I like knowing that, no matter what, I'll never know it all. I could have two lifetimes and still not know everything about Linux.
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,204
Reaction score
6,114
Credits
24,183
It's a new one on me too, David.

Ta for sharing :)

Wiz
 

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
979
Reaction score
824
Credits
6,975
New here also, But does not see to work in KDE distros will have to investigate further on that one.
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
Ta for sharing

Between us we've been using Linux for like a few decades and not noticed it. I was pretty pleased when I found it, so I had to share.

New here also, But does not see to work in KDE distros will have to investigate further on that one.

Hmm... Have you tried multiple terminals - such as installing Terminator and trying there?
 

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
979
Reaction score
824
Credits
6,975
Between us we've been using Linux for like a few decades and not noticed it. I was pretty pleased when I found it, so I had to share.



Hmm... Have you tried multiple terminals - such as installing Terminator and trying there?
No haven't had time yet will next week I hope.
 

Dart

Member
Joined
Jan 5, 2022
Messages
34
Reaction score
33
Credits
323
Check your keyboard shortcuts. There's a whole bunch of stuff already setup in there. You can also create your own. Back in 2011 I got tired of having manually move the windows around so I wrote script that uses wmctrl, xwininfo and xdotool to change window sizes and placement. I used the keyboard shortcuts tool under the menu > control center > Keyboard shortcuts (In Manjaro anyway). There's already a bunch of window commands, but none did what I wanted to do. ;) The less I have to use the mouse, the more I can get done. :D
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,618
Reaction score
3,325
Credits
33,512

kibasnowpaw

Gold Member
Gold Supporter
Joined
Jan 2, 2022
Messages
120
Reaction score
69
Credits
946
nice that make clearing so much easer.
 
OP
K

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,164
Reaction score
5,535
Credits
49,689
nice that make clearing so much easer.

I expect it to be quite handy and worth remembering, as I take a lot of screenshots. I like them to be more or less neat and tidy, without superfluous information. So, I always manually type clear and take my screenshots after that. CTRL + :L should be much faster.
 

gvisoc

Well-Known Member
Joined
May 29, 2020
Messages
379
Reaction score
440
Credits
3,908
I knew this one!!

It's not only quicker than clear, but as it is not a command but a terminal emulator feature, it also preserves the exit code of the last command, which is useful.

Try this:
Code:
$ nonexisting command
zsh: nonexisting: command not found...

# press CTRL+L here to clear the screen
$ echo $?
127

$ nonexisting command
zsh: nonexisting: command not found...

$ clear
$ echo $?
0

$
 

charlie.corder

Active Member
Joined
May 25, 2019
Messages
58
Reaction score
162
Credits
556
I expect it to be quite handy and worth remembering, as I take a lot of screenshots. I like them to be more or less neat and tidy, without superfluous information. So, I always manually type clear and take my screenshots after that. CTRL + :L should be much faster.
Hey KG,

Just goes to show that you are never too old to learn!!!! LOL.

There is joy in learning new stuff. Thanks for the 'new' trick. I'm on Mint and it works on the installed terminal.

I guess that's part of the reason I am involved with Linux.
I have been foolin around with the C language off and on for about a year or so. One of the things I read was that C is not difficult to learn, but it takes a long time to learn it. The reason for being long to learn is because of how vast the program is, not because of difficulty per se.

I am not a programmer or ever will be. But, that is not the reason I have spent time learning some of the basic things in C. The joy I get when the light comes on in my brain when I finally understand something that has been puzzling me, is well worth the effort spent.

Old Geez!!!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Latest posts

Top