Ubuntu – Can I create a separate bash history file for each terminal profile


I use a bash script to start gnome-terminal with multiple tabs, each tab using a different profile, working directory, and in some cases executing a command within the tab.

In this situation, I'd like for the up arrow key to retrieve commands that were used in a specific tab. Is this possible?

Best Answer

  • I suppose you can use a gnome-terminal custom command for each profile, for example

    bash -c 'PROFILE=default_profile exec bash'


    bash -c 'PROFILE=screen_profile exec screen -U'

    or similar.

    Then in ~/.bashrc

    if [[ -n $PROFILE ]]; then