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

Now if I type s and press would show me

sudo -s

How can I acheive this?

  • 1
    Type history in Terminal. All command history are stored in ~/.bash_history file – αғsнιη Jun 29 '14 at 8:40
  • That doesn't answer my question. – M.Tarun Jun 29 '14 at 8:46
  • 2
    possible duplicate of Bash history search, partial + up-arrow – TuKsn Jun 29 '14 at 8:53
  • Your question is How to see command history? and my answer is current for your question. change your question title first. – αғsнιη Jun 29 '14 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 '14 at 16:18

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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.