Output of history command in iTerm

32,258

Check you home dir in iTerm.

$ cd ~
$ ls -la | grep .bash_history

If the above command found the file you can do the following command

$ cat .bash_history

This will show your history. Not in the exact same format as 'history' but it will do I think. Or you can search within your history with the shortcut CTRL + r. It will show something as (reverse-i-search). Type your command you did earlier and it will return a result.

Note: Some terminals have a different shell. For instance zsh. If that's the case you need to search .zsh_history

Share:
32,258

Related videos on Youtube

hap497
Author by

hap497

Updated on September 17, 2022

Comments

  • hap497
    hap497 almost 2 years

    I am using 'iterm' as my terminal at macosx. But I don't see all my command I type when I do 'history' and I don't see my previous command (copy and paste) using the UP arrow key?

    Is there a way to fix it?

    • Bill Reardon
      Bill Reardon over 14 years
      Can you give us a repeatable example?
    • Tadeusz A. Kadłubowski
      Tadeusz A. Kadłubowski over 14 years
      History is handled by your shell (most likely GNU bash), not by your terminal program.
    • juanpablo
      juanpablo almost 13 years
      I have same problem
  • saywhatnow
    saywhatnow almost 6 years
    Bear in mind that if you use a bash alternative, you'll need to use it's history equivalent e.g. with ZSH, replace .bash_history with .zsh_history.
  • Jonathan
    Jonathan almost 5 years
    Give that man a Nobel Peace Prize.
  • Community
    Community over 2 years
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.