Skip to content

Instantly share code, notes, and snippets.

@sudipidus
Created April 19, 2025 11:19
Show Gist options
  • Save sudipidus/b136d6dd652892acf5decf08dad8029b to your computer and use it in GitHub Desktop.
Save sudipidus/b136d6dd652892acf5decf08dad8029b to your computer and use it in GitHub Desktop.
Maintaining separate history for each tmux session
# Often times I just want to run previous commands inside tmux sessions and keep a tab on what I was working just before
if [ -n "$TMUX" ]; then
# Get the tmux session name
session_name=$(tmux display-message -p '#S')
export HISTFILE="$HOME/.zsh_history_tmux_${session_name}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment