Keyboard shortcut to jump to the end of the command history in ubuntu terminal [closed]
Asked Answered
U

2

5

I searched the web for this already, with no success. The question is: is there any keyboard shortcut to jump right to the end of the command line history?

I ask because I often use the reverse-i-search Ctrl + R feature to quickly find a previous command in the history, but then I may change my mind and type the command from scratch without overwriting any previous command (so clearing the line with Ctrl + ACtrl + K is not an option). Thus I want to jump back to the empty command line (past the end of the command history).

Right now I can only achieve this by scrolling the history using the down arrow key until I hit the end of the history, but it can be painful since I sometimes have to pass through plenty of entries before reaching the end.

Under answered 5/12, 2014 at 9:44 Comment(0)
T
6

Ctrl + C and UP arrow key.
Ctrl + C -> exits the current browsing of history with Up/Down Key.
Up arrow key -> To get the latest command.

Tarim answered 5/12, 2014 at 10:46 Comment(1)
Thanks. Actually I was only looking for a way to get to the empty line, after the latest command. So, just Ctrl + C will do.Under
F
3

As this answer pointed out you can use Meta + < and Meta + >.

Usually the Meta key is mapped to the Alt or Alt + Shift keys. The < and > keys varies a lot depending on the keyboard and the layout you use.

Indicated shortcut US-EN shortcut Action
Meta + < Alt + Shift + , (comma) Beginning of history
Meta + > Alt + Shift + . (period) End of history

Check out this answer to understand the Meta key.

Fortnight answered 7/7, 2016 at 15:34 Comment(1)
I think this is the better answer, but as it was stated it was incorrect and unclear. Control-C, as used in the other answer, actually inputs a break (SIGI signal) towards the terminal and moves to the next line. Basically, removing the history is a side effect of that.Yonita

© 2022 - 2024 — McMap. All rights reserved.