1
0

bashrc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # ~/.bashrc: executed by bash(1) for non-login shells.
  2. #
  3. # Bash history and shell options
  4. #
  5. # if not running interactively, don't do anything
  6. [ -z "$PS1" ] && return
  7. # don't put duplicate lines or lines starting with space in the history.
  8. # See bash(1) for more options
  9. HISTCONTROL=ignoreboth
  10. # append to the history file, don't overwrite it
  11. shopt -s histappend
  12. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  13. HISTSIZE=1000
  14. HISTFILESIZE=2000
  15. # check the window size after each command and, if necessary,
  16. # update the values of LINES and COLUMNS.
  17. shopt -s checkwinsize
  18. # make less more friendly for non-text input files, see lesspipe(1)
  19. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  20. # enable programmable completion features (you don't need to enable
  21. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  22. # sources /etc/bash.bashrc).
  23. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  24. . /etc/bash_completion
  25. fi
  26. #
  27. # Setting PS1
  28. #
  29. # set variable identifying the chroot you work in (used in the prompt below)
  30. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  31. debian_chroot=$(cat /etc/debian_chroot)
  32. fi
  33. # comment for uncolored terminal
  34. color_prompt=yes
  35. if [ $UID -eq 0 ]; then
  36. USERCOLOR="\[\e[01;31m\]" # Red if running as root
  37. INDICATOR="#"
  38. else
  39. USERCOLOR="\[\e[01;32m\]" # Green otherwise
  40. INDICATOR="$"
  41. fi
  42. if [ "$color_prompt" = yes ]; then
  43. PS1="${debian_chroot:+($debian_chroot)}$USERCOLOR\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$INDICATOR "
  44. else
  45. PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$INDICATOR '
  46. fi
  47. unset color_prompt
  48. #
  49. # Aliases
  50. #
  51. # enable color support of ls and grep
  52. if [ -x /usr/bin/dircolors ]; then
  53. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  54. alias ls='ls --color=auto'
  55. #alias dir='dir --color=auto'
  56. #alias vdir='vdir --color=auto'
  57. alias grep='grep --color=auto'
  58. alias fgrep='fgrep --color=auto'
  59. alias egrep='egrep --color=auto'
  60. fi
  61. # ls shortcuts
  62. alias ll='ls -alFh'
  63. alias la='ls -A'
  64. alias l='ls -CF'
  65. # ssh shortcuts for multivac
  66. alias smv='ssh mv -tt screen -Uxr'
  67. alias mvv='mosh mv -p 8215 -- screen -Uxr'
  68. # more alias fancyness
  69. alias cdhere='cd $(realpath $(pwd))'
  70. alias ocaml='rlwrap ocaml'
  71. # Add an "alert" alias for long running commands. Use like so:
  72. # sleep 10; alert
  73. alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
  74. #
  75. # Environment
  76. #
  77. export TERM="xterm-256color"
  78. export LC_ALL="en_US.UTF-8"
  79. export LANG="$LC_ALL"
  80. export EDITOR=vim
  81. export PATH=$PATH:$HOME/.local/bin
  82. #
  83. # local, installation-specific config
  84. #
  85. [ -f ~/.bashrc_local ] && . ~/.bashrc_local