Skip to content

Instantly share code, notes, and snippets.

@ma4a
Created September 21, 2017 08:51
Show Gist options
  • Select an option

  • Save ma4a/43771b4abdc65ee446581b8d1cb6ab68 to your computer and use it in GitHub Desktop.

Select an option

Save ma4a/43771b4abdc65ee446581b8d1cb6ab68 to your computer and use it in GitHub Desktop.
customized .bashrc
# customizations for bash command line
# alternative path /etc/bash.bashrc
# you can store this file in e.g. /etc/custom.bashrc and reference the file using 'source /etc/custom.bashrc' inside the /etc/bash.bashrc file to keep customizations at a separate place
#ALIAS commands to customize commands and create shortcuts
alias ..='cd ..'
alias app='apropos '
alias ag="sudo apt-get update && sudo apt-get install && sudo apt-get upgrade" #install all available software updates (prompt for final install decision)
alias c='clear'
alias fuck='sudo $(history -p \!\!)' #execute previous command with sudo
alias genpw='pwgen 32 -s1' # generate secure random password
alias gks=gksudo
alias iotop='iotop -ao'
alias ls='ls --color'
alias lsft='find . -type f | rev | cut -d . -f1 | egrep '\^.[^/]{,10}$'\ | rev | sort | uniq -ic | sort -rn | head -n20' #count files by filetype/extension
alias lsblk='lsblk -io NAME,TYPE,SIZE,MOUNTPOINT,FSTYPE,MODEL' #format listing of storage devices
alias l='ls --color'
alias la='ls -lah --color'
alias lastu='last -F -30 -w'
alias netstat='netstat -antup'
alias publicip='curl -A "" canihazip.com/s' #fetch public IP via webservice
alias s=sudo
alias sagi='sudo apt-get install' # shortcut to install software via apt-get
alias scannet='sudo arp-scan --localnet' # scan local network for available devices and IPs
alias stresstest='stress --cpu 16 --io 5 --vm 10 --vm-bytes 512M --timeout 600s'
alias sysupgrade="sudo sh -c 'aptitude update; aptitude -DrVWZ full-upgrade; aptitude autoclean; exit'"
alias u='uptime'
alias w1='watch -n1' #check command output every second
alias wlog='tail -F' #read logfile and watch for new entries
alias x='exit'
#*****
#set locale to german
export LANG="de_DE.UTF-8"
export LANGUAGE='de_DE:de:en_US:en'
export LC_ALL=
#*****
#custom SETTINGS
#don't add commands with space prefix to command-history -> <space>command
export HISTCONTROL=ignorespace
#change shell prompt with colors
PS1='\[\033[1;32m\](\[\033[1;32m\]\u\[\033[1;31m\]@\h\[\033[1;31m\]:\[\033[1;36m\]\w\[\033[1;32m\])\[\033[1;36m\]\$ \[\033[0;37m\]'
# 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
#logout user from tty1-tty6 (Strg+Alt+F1-F6) after timeout (1800=30m)
if $(tty) =~ /dev\/tty[1-6] ; then TMOUT=1800; fi 1>/dev/null 2>&1
#inlcude ~/bin into path
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment