3

I recently saw an article on the internet. Using that by typing the first letter and pressing ↑ would show me the command starting with that letter.
For example let this be my command history:

sudo -s
ls
nautilus

Now if I type s and press ↑ would show me

sudo -s

How can I acheive this?

M.Tarun
  • 5,121

1 Answers1

3

Two more useful things to know about this...

To execute a specific command from your history, you can just type an exclamation point followed by the number of the command as listed by history. So, to re-execute command number 510.

!510

To rerun your previous command just type two exclamation points. So when you run a command that needs super-user privileges and you forgot to do that - just give it the old “sudo bang bang” treatment:

sudo !!
snori74
  • 91
  • 4