Skip to content

Instantly share code, notes, and snippets.

@SammysHP
Created October 22, 2013 19:06
Show Gist options
  • Save SammysHP/7106317 to your computer and use it in GitHub Desktop.
Save SammysHP/7106317 to your computer and use it in GitHub Desktop.
My .bashrc
##
## /home/sammyshp/.bashrc.d/00-bash-environment.sh
##
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# vi-kompatibler Modus
set -o vi
##
## /home/sammyshp/.bashrc.d/10-bash-prompt.sh
##
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
[ -n "$SSH_TTY" ] && PS1='\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
##
## /home/sammyshp/.bashrc.d/11-xterm-title.sh
##
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
##
## /home/sammyshp/.bashrc.d/20-terminal-colors.sh
##
if [ "$TERM" = "linux" ]; then
echo -en "\e]P0000000" #black
echo -en "\e]P8686868" #darkgrey
echo -en "\e]P1DC322F" #darkred
echo -en "\e]P9FF6565" #red
echo -en "\e]P267AA00" #darkgreen
echo -en "\e]PA9BFF00" #green
echo -en "\e]P3B58900" #brown
echo -en "\e]PBFFED27" #yellow
echo -en "\e]P4016BB6" #darkblue
echo -en "\e]PC45B2FF" #blue
echo -en "\e]P5C332B7" #darkmagenta
echo -en "\e]PDFF00FF" #magenta
echo -en "\e]P627978F" #darkcyan
echo -en "\e]PE00EDED" #cyan
echo -en "\e]P7B2B2B2" #lightgrey
echo -en "\e]PFFFFFFF" #white
# clear #for background artifacting
fi
##
## /home/sammyshp/.bashrc.d/50-alias-colors.sh
##
# enable color support of ls and grep
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias rgrep='rgrep --color=auto'
fi
##
## /home/sammyshp/.bashrc.d/50-alias-force-en.sh
##
# some commands always in English
alias man='LANG=en_US.UTF-8 man'
alias git='LANG=en_US.UTF-8 git'
##
## /home/sammyshp/.bashrc.d/50-alias-interactive.sh
##
# interactive filehandling (ask before delete/overwrite)
alias rm='rm -I'
alias mv='mv -i'
alias cp='cp -i'
##
## /home/sammyshp/.bashrc.d/50-alias-ls.sh
##
# ls aliases
alias ll='ls -lFh'
alias lla='ls -AlFh'
alias la='ls -A'
alias l='ls -CF'
##
## /home/sammyshp/.bashrc.d/50-alias-misc.sh
##
# ssh compatibility
alias ssh='TERM=rxvt-unicode ssh'
# turn off display
alias screenoff='xset dpms force off'
# sync university files
alias update-studium='rsync -rtlvhb --backup-dir=/home/sammyshp/uni/backup-sync/ --delete mosquito:uni/ /home/sammyshp/uni/sync/'
# open files via xdg-open and nohup
function xo { nohup xdg-open "$@" &> /dev/null & }
# webradio station shortcuts
alias play-indiepoprock='mplayer -playlist http://somafm.com/startstream=indiepop.pls'
# SOCKS tunnel with ssh
alias ssh-proxy='ssh -D 9999 -C'
# list all gpg keys with signatures (via colorgpg)
alias gpg-list='colorgpg --list-sigs'
# ps shortcut
alias psl='ps aux | less'
# Reattach tmux session or create new one
alias remux='if tmux has-session 2> /dev/null; then tmux attach; else tmux new; fi'
# ln -s with canonical path
function lns { ln -s `readlink -fn "$1"` "$2"; }
# sudo with completion
alias sudo='sudo '
##
## /home/sammyshp/.bashrc.d/50-alias-udisks2.sh
##
alias mnt='udisksctl mount -b'
alias umnt='udisksctl unmount -b'
##
## /home/sammyshp/.bashrc.d/80-environment-misc.sh
##
export EDITOR=/usr/bin/vim
export VISUAL=/usr/bin/vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment