reuse terminal commands and parameters of commands
In linux terminal you don't have to type each command and its parameters letter by letter.


When you want to reuse the command that you used before you can press ctrl+r and type the part of that command. For example a few days ago you put

Now you can just press ctrl+r and type

The whole command should appear. If not press ctrl+r repeatedly.

Esc and . (Esc and dot)

You can also reuse the parameter part of the last command by pressing Esc and dot. (Not simultaneously)

Both tricks are very useful.
We can repeat the commands by pressing the up-arrow, how is this different than up-arrow?
I second @Jayce 's question.

I find the up arrow more convenient than the ctrl+r on a computer or on mobile

[Image: img.php?userid=19870&txt=1]

A huge shoutout to GalaxyHostPlus for the stellar OpenVZ VPS
Follow me on Mastodon
View me on IRC @SlashNET

Up and down arrows allow you to scroll through your command history to use commands you used before again. This guide is about a reverse search function in the command history that allows to find specific commands you want to use again instead of pressing the up arrow hundreds of times.
We are the sum of our memories. Erasing the memories edged in oneself is the same as loosing oneself.
Using ctrl+r instead of up arrow may be quicker sometimes. Imagine you want to restart apache webserver. You remember that you restarted it two or three days ago. So you can use ctrl+r rest then and get it quickly.  In the case of pressing up arrow you would have to press it hundreds of times.

Of course knowing up arrow functionality is very helpful too.
I learnt it while trying my hands on vim. I always have multiple ssh sessions open and that's why i use command history append and then sort and clean similar commands and put the important and long ones as alias. That saves presto and ctrl+r and all that or use up arrow. But when you want to repeat a long and recently used new command, it really helps.
Many thanks to Freevps, Chris (cw1998), The Guy( ID 4810), optimus, GHP and the other  staff members.

Users browsing this thread: 1 Guest(s)