As a satisfied user of Arch Linux (relax, I am not your stereotypical toxic Arch user), I use Linux every day for my personal life (I have MacBook for work ๐คฎ). Here are useful .bashrc
snippets from my actual .bashrc
, for everyday Linux life.
This is a stub post. To be updated over time.
Prompt and basics
1#!/usr/bin/env bash
2# Snippets from Sid's .bashrc file.
3# Do not call `set -euo pipefail` from your habit in .bashrc.
4
5##########
6# Basics #
7##########
8
9# Turn the history verification on
10# (confirming the command after calling it from history with '!')
11shopt -s histverify
12
13# Default PS1 in Debian style for fallback.
14# It is solely my preference, though.
15export PS1="\u@\h:\w\$ "
16
17__prompt_command () {
18 # Default PS1 in coloured Debian style.
19 PS1="\[\033[1;32m\]\u@\h\[\033[00m\]:\[\033[1;34m\]\w\[\033[00m\]\$ "
20
21 # Uncomment this if you use anaconda for python environment management.
22 # if [[ ! "$CONDA_DEFAULT_ENV" == "base" ]] && [[ ! -z "${CONDA_DEFAULT_ENV+x}" ]]; then
23 # PS1="\[\033[1;33m\]($CONDA_DEFAULT_ENV)\[\033[00m\] $PS1"
24 # fi
25
26 # Now we export the PS1 and print the terminal title characters.
27 export PS1
28 printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
29}
30# Apply the __prompt_command() only for specific terminal types.
31[[ "${TERM}" =~ "color" || "${TERM}" =~ "rxvt" || "${TERM}" =~ "kitty" ]] && export PROMPT_COMMAND=__prompt_command