MacOS – How to Read All Terminal Command History in OS X

macosterminal

It would be great to access all my commands run in terminal on OS X so I can review and use as a running reminder sheet.

I'm using Reverse-I-Search prompt, and have updated my .bash_profile to store all of my history as mentioned here on Mactoids: How to search Terminal command history.

  1. Start Terminal.

  2. Navigate to the Home folder by entering:

    cd ~/
    
  3. Create .bash_profile by entering:

    touch .bash_profile
    
  4. Now, either edit .bash_profile in your favorite text editor or type this in the Terminal window to automatically open the file in the default TextEdit:

    open -e .bash_profile
    
  5. Lastly, add this to the .bash_profile file:

    HISTFILESIZE=1000000000 HISTSIZE=1000000
    
  6. Save and exit.

Do you have any ideas how I could access in order to output the terminal command history in OS X?

Best Answer

All of your history is stored in ~/.bash_history, where both reverse-i-search and the up/down keys use. That file is regularly pruned, but if you followed the guide in your link, the .bash_history file will practically never be pruned.

Related Question