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?

6
  • 1
    Type history in Terminal. All command history are stored in ~/.bash_history file Jun 29, 2014 at 8:40
  • That doesn't answer my question.
    – M.Tarun
    Jun 29, 2014 at 8:46
  • 2
    possible duplicate of Bash history search, partial + up-arrow
    – TuKsn
    Jun 29, 2014 at 8:53
  • Your question is How to see command history? and my answer is current for your question. change your question title first. Jun 29, 2014 at 16:15
  • I able not able to figure out an appropriate one. Will you help me in figuring out a title for this quesion?
    – M.Tarun
    Jun 29, 2014 at 16:18

1 Answer 1

2

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 !!
1
  • Did you see the example in my question?
    – M.Tarun
    Jun 29, 2014 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .