0

I have seen a ~/.bash_sessions/~ folder being created, and I want to clean up my home directory, but I could not find which bash option can tell it to use a more proper location like ~/.cache/ for these files.

2 Answers 2

0

You could tell bash to not create a history:

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.

source

0

You should be able to change the location of this folder based off of an environment variable. Since you didn't say which shell your are using it's not possible to completely help you with that much detail, sorry

As far as I know Apple has switched from bash to zsh as of MacOS 10.5. You can define the appropriate environment variable in .zprofile.

If you're using bash you can define the HISTFILE variable in your ~/.bashrc. You can also choose to limit the length, the default is 500.

In bash the history session file is given by the environment variable HISTFILE. For more information see the bash docs.

Here is a related question about completely removing the .bash_sessions folder: https://superuser.com/questions/1610587/disable-zsh-session-folder-completely

You must log in to answer this question.

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