Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • this could work but doesn't handle multiple sessions.. I supposed i can create a random temp file to store it in Commented Dec 3, 2014 at 23:21
  • 1
    @Mike use a name connected with the shell PID, perhaps ~/$$_history. Commented Dec 3, 2014 at 23:23
  • 4
    It's worth noting that this won't clear out the history or affect the normal history saving in any way! I wasn't sure until I tested it. :) Commented Jan 29, 2015 at 2:10
  • I find it more convenient to just do history -a it throws it along with the previous history into ~/.bash_history ... which could be a problem if your history is longer than the cutoff, which is a 1000 on my centos7 and fedora 24 systems. Commented Jun 5, 2017 at 20:53