1

I didn't see this question asked or could find any answers when I Googled but I thought history -c would clear all my Bash history but there are still several files in .bash_sessions located under /Users/user/.bash_sessions.

What is the difference between these files and the bash history file of .bash_history? Can the files in this directory (/.bash_sessions) be deleted safely? There are over 200 files with random letters, numbers and dashes followed by the extensions of .historynew, .history and .session.

1

A session file is commands from a single session.

The history is an incomplete collection of commands used in any session.

I don't know for sure whether anything (other than loss of history) would occur from deleting them, but I suspect not. An easy test would be move them all to another directory, then move them back if you see a problem.

0

As long as you do not need the shell session history information stored for any reason, then to stop the .history and .historynew files from being created, you can add SHELL_SESSION_HISTORY=0 to your ~/.bash_profilefile or ~/.bashrc file and restart Terminal and it will stop creating those files.

If you do not want the .session files, then in your $HOME directory use touch .bash_sessions_disable. However I would do that and just clean out the .bash_sessions directory once in a while.

Yes, it's safe to delete the file in the .bash_sessions directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .