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



ctrl+r

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

Code:
ssh 123.45.67.89


Now you can just press ctrl+r and type

Quote:.8

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.
#2
We can repeat the commands by pressing the up-arrow, how is this different than up-arrow?
#3
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]

Thanks to FREEVPS.us  for VPS 14
A huge shoutout to @F7N for the steller cPanel Hosting
Follow me on Mastodon
View me on IRC @SlashNET
You can also Buy me coffee

[url=https://7ob.pw/FreeVPS/?userid=19870][/url]
#4
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.
#5
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.
#6
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: 2 Guest(s)

Switch to mobile version

Sponsors: Ftpit - ZXPlay - GalaxyHostPlus - Verelox- HostUS - HostMada - Host4Fun - Evolution-Host - NodeBlade - HostDare - VPSMost


BitCoin donations: 1DQxbstaTb5SWk6QC2gFeQUTFR64JX4cEo