Skip to content

Instantly share code, notes, and snippets.

@vbrozik
Last active June 25, 2023 20:45
Show Gist options
  • Save vbrozik/b314d548d6727a32d7703a4a13002d42 to your computer and use it in GitHub Desktop.
Save vbrozik/b314d548d6727a32d7703a4a13002d42 to your computer and use it in GitHub Desktop.
Bash - customizations

Bash - customizations

Command history

Settings in .bashrc:

# separate history files
HISTFILE=$HOME/.history/$(date +%y%m%d.%H%M%S).$USER.$TERM.$SSH_PORT.$$

# Ignore duplicate commands
export HISTCONTROL=ignoredups

# Save history after each command (when new prompt is displayed)
PROMPT_COMMAND="$PROMPT_COMMAND;history -a; history -n"

Ideas

  • Do not use ignoredups but periodically copy history file content as a command log and deduplicate the original history file.

Customization in VS Code terminals

// settings.json

"terminal.integrated.profiles.linux": {
  "bash1": {
    "path": "bash",
    "args": ["--rcfile", "${workspaceFolder}/.vscode/.bashrc1"]
  },
  "bash2": {
    "path": "bash",
    "args": ["--rcfile", "${workspaceFolder}/.vscode/.bashrc2"]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment