Read all of the terminal command history in OS XTerminal is showing computer name as a weird number?linux:...

How to tighten battery clamp?

Are small insurances worth it

How would we write a misogynistic character without offending people?

What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?

Can you 'upgrade' leather armor to studded leather armor without purchasing the new armor directly?

Is there any relevance to Thor getting his hair cut other than comedic value?

Equivalent to "source" in OpenBSD?

Make me a metasequence

How to count occurrences of Friday 13th

Does music exist in Panem? And if so, what kinds of music?

How can I be pwned if I'm not registered on that site?

How do I implement simple JS code to deploy a compiled smart contract to ganache-cli?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

Casually inserting sexuality

You'll find me clean when something is full

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

If nine coins are tossed, what is the probability that the number of heads is even?

When does inspiration across artforms become plagiarism

What if I store 10TB on azure servers and then keep the vm powered off?

Skis versus snow shoes - when to choose which for travelling the backcountry?

Can chords be played on the flute?

Is there a low-level alternative to Animate Objects?

Understanding Kramnik's play in game 1 of Candidates 2018

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?



Read all of the terminal command history in OS X


Terminal is showing computer name as a weird number?linux: package for specific “command history” on terminal line?Terminal command 'edit' unknown (OSX 10.8.1) : -bash: edit: command not foundterminal.app: how to read the terminal window titleRetrieve history on terminal (macOS)Running terminal command on all files in folder?terminal previous history command overwrite charactersTrackpad scroll in Yosemite's terminal broken, now only showing command historyTerminal 'last' command doesn't display login historyI accidentally set my default terminal command to “killall Terminal”See output command terminal history in zsh terminal













8















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?










share|improve this question















migrated from stackoverflow.com Jul 10 '11 at 23:11


This question came from our site for professional and enthusiast programmers.














  • 4





    I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

    – nobody
    Jul 10 '11 at 21:46











  • Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

    – Cameron McGrane
    Jul 11 '11 at 1:15
















8















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?










share|improve this question















migrated from stackoverflow.com Jul 10 '11 at 23:11


This question came from our site for professional and enthusiast programmers.














  • 4





    I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

    – nobody
    Jul 10 '11 at 21:46











  • Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

    – Cameron McGrane
    Jul 11 '11 at 1:15














8












8








8


2






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?










share|improve this question
















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?







macos terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 29 '16 at 6:45









karel

9,27293139




9,27293139










asked Jul 10 '11 at 21:25









Cameron McGraneCameron McGrane

150115




150115




migrated from stackoverflow.com Jul 10 '11 at 23:11


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Jul 10 '11 at 23:11


This question came from our site for professional and enthusiast programmers.










  • 4





    I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

    – nobody
    Jul 10 '11 at 21:46











  • Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

    – Cameron McGrane
    Jul 11 '11 at 1:15














  • 4





    I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

    – nobody
    Jul 10 '11 at 21:46











  • Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

    – Cameron McGrane
    Jul 11 '11 at 1:15








4




4





I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

– nobody
Jul 10 '11 at 21:46





I presume you've read man bash, so you should know that the history is stored in the file ~/.bash_history. What else do you need to know, can you clarify?

– nobody
Jul 10 '11 at 21:46













Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

– Cameron McGrane
Jul 11 '11 at 1:15





Yes, because I new the 'man' command existed then read the manual found the answer and decided to ask the question above just for the fun of it. Thanks fideli for quick, clear and unpretentious answer.

– Cameron McGrane
Jul 11 '11 at 1:15










3 Answers
3






active

oldest

votes


















6














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.






share|improve this answer































    1














    In case you still need a fix for this, here's how I did mine. With this, I can SAVE AND ACCESS history across all tabs (i.e. if you enter a command on one tab, then open a new tab and press up, it will suggest the command you just entered in the previous tab)



    You'll need 2 things: 1. Enter this command in your terminal to make sure histappend is turned on:



    shopt -s histappend && shopt histappend


    2. You'll also need to know where your history commands are being stored.



    My history files are stored in ~/.bash_sessions so that's what my code will reflect. If yours are stored in ~/.bash_history, or another directory, just swap that for ~/.bash_sessions when we source it into our bash_profile.



    Once you've figured that out, open your bash_profile and add the following code:



    source ~/.bash_sessions/*.history        #<--sources prev sessions through your bash_profile. If you don't use ~/.bash_sessions to store your history, replace it with whatever you use (i.e. source ~/.bash_history/*.history

    export HISTCONTROL=ignoredups:erasedups #<-- auto-erases duplicates in your history
    export HISTSIZE=1000 #<-- assigns # of results to return
    export HISTFILESIZE=100000 #<-- assigns # of results to store in your .bash_history
    shopt -s histappend #<-- appends & saves history throughout all tabs

    export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" <--appends history from all tabs, clears & uses appended history file as current





    share|improve this answer



















    • 1





      be aware that running source ~/.bash_sessions/*.history executes all the commands

      – panchicore
      Mar 21 '18 at 8:08



















    0














    Personally, I would prefer to do it in a simpler way and print everything, instead of checking the latest session which doesn't cover all Terminal windows and all commands.



    Get a full history



    cd ~/.bash_sessions
    cat *.historynew *.history


    If you want to sort by session date



    cd ~/.bash_sessions
    cat `ls -tr *.historynew *.history`





    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f308919%2fread-all-of-the-terminal-command-history-in-os-x%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      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.






      share|improve this answer




























        6














        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.






        share|improve this answer


























          6












          6








          6







          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.






          share|improve this 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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 10 '11 at 23:19









          fidelifideli

          13.2k12942




          13.2k12942

























              1














              In case you still need a fix for this, here's how I did mine. With this, I can SAVE AND ACCESS history across all tabs (i.e. if you enter a command on one tab, then open a new tab and press up, it will suggest the command you just entered in the previous tab)



              You'll need 2 things: 1. Enter this command in your terminal to make sure histappend is turned on:



              shopt -s histappend && shopt histappend


              2. You'll also need to know where your history commands are being stored.



              My history files are stored in ~/.bash_sessions so that's what my code will reflect. If yours are stored in ~/.bash_history, or another directory, just swap that for ~/.bash_sessions when we source it into our bash_profile.



              Once you've figured that out, open your bash_profile and add the following code:



              source ~/.bash_sessions/*.history        #<--sources prev sessions through your bash_profile. If you don't use ~/.bash_sessions to store your history, replace it with whatever you use (i.e. source ~/.bash_history/*.history

              export HISTCONTROL=ignoredups:erasedups #<-- auto-erases duplicates in your history
              export HISTSIZE=1000 #<-- assigns # of results to return
              export HISTFILESIZE=100000 #<-- assigns # of results to store in your .bash_history
              shopt -s histappend #<-- appends & saves history throughout all tabs

              export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" <--appends history from all tabs, clears & uses appended history file as current





              share|improve this answer



















              • 1





                be aware that running source ~/.bash_sessions/*.history executes all the commands

                – panchicore
                Mar 21 '18 at 8:08
















              1














              In case you still need a fix for this, here's how I did mine. With this, I can SAVE AND ACCESS history across all tabs (i.e. if you enter a command on one tab, then open a new tab and press up, it will suggest the command you just entered in the previous tab)



              You'll need 2 things: 1. Enter this command in your terminal to make sure histappend is turned on:



              shopt -s histappend && shopt histappend


              2. You'll also need to know where your history commands are being stored.



              My history files are stored in ~/.bash_sessions so that's what my code will reflect. If yours are stored in ~/.bash_history, or another directory, just swap that for ~/.bash_sessions when we source it into our bash_profile.



              Once you've figured that out, open your bash_profile and add the following code:



              source ~/.bash_sessions/*.history        #<--sources prev sessions through your bash_profile. If you don't use ~/.bash_sessions to store your history, replace it with whatever you use (i.e. source ~/.bash_history/*.history

              export HISTCONTROL=ignoredups:erasedups #<-- auto-erases duplicates in your history
              export HISTSIZE=1000 #<-- assigns # of results to return
              export HISTFILESIZE=100000 #<-- assigns # of results to store in your .bash_history
              shopt -s histappend #<-- appends & saves history throughout all tabs

              export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" <--appends history from all tabs, clears & uses appended history file as current





              share|improve this answer



















              • 1





                be aware that running source ~/.bash_sessions/*.history executes all the commands

                – panchicore
                Mar 21 '18 at 8:08














              1












              1








              1







              In case you still need a fix for this, here's how I did mine. With this, I can SAVE AND ACCESS history across all tabs (i.e. if you enter a command on one tab, then open a new tab and press up, it will suggest the command you just entered in the previous tab)



              You'll need 2 things: 1. Enter this command in your terminal to make sure histappend is turned on:



              shopt -s histappend && shopt histappend


              2. You'll also need to know where your history commands are being stored.



              My history files are stored in ~/.bash_sessions so that's what my code will reflect. If yours are stored in ~/.bash_history, or another directory, just swap that for ~/.bash_sessions when we source it into our bash_profile.



              Once you've figured that out, open your bash_profile and add the following code:



              source ~/.bash_sessions/*.history        #<--sources prev sessions through your bash_profile. If you don't use ~/.bash_sessions to store your history, replace it with whatever you use (i.e. source ~/.bash_history/*.history

              export HISTCONTROL=ignoredups:erasedups #<-- auto-erases duplicates in your history
              export HISTSIZE=1000 #<-- assigns # of results to return
              export HISTFILESIZE=100000 #<-- assigns # of results to store in your .bash_history
              shopt -s histappend #<-- appends & saves history throughout all tabs

              export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" <--appends history from all tabs, clears & uses appended history file as current





              share|improve this answer













              In case you still need a fix for this, here's how I did mine. With this, I can SAVE AND ACCESS history across all tabs (i.e. if you enter a command on one tab, then open a new tab and press up, it will suggest the command you just entered in the previous tab)



              You'll need 2 things: 1. Enter this command in your terminal to make sure histappend is turned on:



              shopt -s histappend && shopt histappend


              2. You'll also need to know where your history commands are being stored.



              My history files are stored in ~/.bash_sessions so that's what my code will reflect. If yours are stored in ~/.bash_history, or another directory, just swap that for ~/.bash_sessions when we source it into our bash_profile.



              Once you've figured that out, open your bash_profile and add the following code:



              source ~/.bash_sessions/*.history        #<--sources prev sessions through your bash_profile. If you don't use ~/.bash_sessions to store your history, replace it with whatever you use (i.e. source ~/.bash_history/*.history

              export HISTCONTROL=ignoredups:erasedups #<-- auto-erases duplicates in your history
              export HISTSIZE=1000 #<-- assigns # of results to return
              export HISTFILESIZE=100000 #<-- assigns # of results to store in your .bash_history
              shopt -s histappend #<-- appends & saves history throughout all tabs

              export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" <--appends history from all tabs, clears & uses appended history file as current






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 29 '16 at 5:27









              sharpharpsharpharp

              112




              112








              • 1





                be aware that running source ~/.bash_sessions/*.history executes all the commands

                – panchicore
                Mar 21 '18 at 8:08














              • 1





                be aware that running source ~/.bash_sessions/*.history executes all the commands

                – panchicore
                Mar 21 '18 at 8:08








              1




              1





              be aware that running source ~/.bash_sessions/*.history executes all the commands

              – panchicore
              Mar 21 '18 at 8:08





              be aware that running source ~/.bash_sessions/*.history executes all the commands

              – panchicore
              Mar 21 '18 at 8:08











              0














              Personally, I would prefer to do it in a simpler way and print everything, instead of checking the latest session which doesn't cover all Terminal windows and all commands.



              Get a full history



              cd ~/.bash_sessions
              cat *.historynew *.history


              If you want to sort by session date



              cd ~/.bash_sessions
              cat `ls -tr *.historynew *.history`





              share|improve this answer




























                0














                Personally, I would prefer to do it in a simpler way and print everything, instead of checking the latest session which doesn't cover all Terminal windows and all commands.



                Get a full history



                cd ~/.bash_sessions
                cat *.historynew *.history


                If you want to sort by session date



                cd ~/.bash_sessions
                cat `ls -tr *.historynew *.history`





                share|improve this answer


























                  0












                  0








                  0







                  Personally, I would prefer to do it in a simpler way and print everything, instead of checking the latest session which doesn't cover all Terminal windows and all commands.



                  Get a full history



                  cd ~/.bash_sessions
                  cat *.historynew *.history


                  If you want to sort by session date



                  cd ~/.bash_sessions
                  cat `ls -tr *.historynew *.history`





                  share|improve this answer













                  Personally, I would prefer to do it in a simpler way and print everything, instead of checking the latest session which doesn't cover all Terminal windows and all commands.



                  Get a full history



                  cd ~/.bash_sessions
                  cat *.historynew *.history


                  If you want to sort by session date



                  cd ~/.bash_sessions
                  cat `ls -tr *.historynew *.history`






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 8 hours ago









                  Laimis LaimisonLaimis Laimison

                  214




                  214






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f308919%2fread-all-of-the-terminal-command-history-in-os-x%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                      VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                      Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...