# Bash History Configuration
# Add this to your ~/.bashrc file

# ============================================
# HISTORY SIZE CONFIGURATION
# ============================================

# Number of commands to remember in memory
export HISTSIZE=50000

# Number of commands to save in history file
export HISTFILESIZE=100000

# ============================================
# HISTORY FORMAT
# ============================================

# Add timestamps to history (YYYY-MM-DD HH:MM:SS format)
export HISTTIMEFORMAT="%F %T "

# ============================================
# HISTORY CONTROL
# ============================================

# Avoid duplicate entries
export HISTCONTROL=ignoredups:erasedups

# Ignore common commands that clutter history
export HISTIGNORE="ls:ll:cd:pwd:exit:date:clear:history:bg:fg"

# ============================================
# HISTORY BEHAVIOR
# ============================================

# Append to history file, don't overwrite it
shopt -s histappend

# Save multi-line commands as one command
shopt -s cmdhist

# ============================================
# REAL-TIME HISTORY SYNC
# ============================================

# Save history after each command
# Useful for multiple terminal sessions
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

# ============================================
# OPTIONAL: UNLIMITED HISTORY
# ============================================

# Uncomment for unlimited history (use with caution)
# export HISTSIZE=-1
# export HISTFILESIZE=-1

# ============================================
# SECURITY: IGNORE SENSITIVE COMMANDS
# ============================================

# Commands starting with space won't be saved
# (requires HISTCONTROL=ignorespace or ignoreboth)
# Usage: <space>mysql -u root -p secret_password
