Skip to content

Instantly share code, notes, and snippets.

@franga2000
Created January 18, 2017 11:59
Show Gist options
  • Save franga2000/0a222d39d07c84ba58cf722172e72a99 to your computer and use it in GitHub Desktop.
Save franga2000/0a222d39d07c84ba58cf722172e72a99 to your computer and use it in GitHub Desktop.
My awesome .bashrc - feel free to steal stuff
# franga2000's .bashrc of awesomness
# Human-readable units
alias ll='ls -alh'
alias l='ls -CF'
alias du='du -h'
alias df='df -h'
alias free='free -h'
# Disaster prevention
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
# Typos
alias cd..='cd ..'
# Less is more
alias more='less'
export PAGER=less
# HTTPie is love HTTPie is life
alias wget='http -d'
# Color definitions (I'm lazy)
export C_CLEAR='\[\e[0m\]'
export C_WHITE='\[\e[1;37m\]'
export C_BLACK='\e[0;30m\]'
export C_BLUE='\e[0;34m\]'
export C_LIGHT_BLUE='\[\e[1;34m\]'
export C_GREEN='\[\e[0;32m\]'
export C_LIGHT_GREEN='\[\e[1;32m\]'
export C_CYAN='\[\e[0;36m\]'
export C_LIGHT_CYAN='\[\e[1;36m\]'
export C_RED='\[\e[0;31m\]'
export C_LIGHT_RED='\[\e[1;31m\]'
export C_PURPLE='\[\e[0;35m\]'
export C_LIGHT_PURPLE='\[\e[1;35m\]'
export C_BROWN=\['\e[0;33m\]'
export C_YELLOW='\[\e[1;33m\]'
export C_GRAY='\[\e[0;30m\]'
export C_LIGHT_GRAY='\[\e[0;37m\]'
# Enable colors
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
# Colored manpages (thanks Arch wiki)
man() {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
# Fuck Vi
alias vi='vim'
# MOAR COLORS!
PS1="\\[$C_LIGHT_RED\u$C_LIGHT_GRAY@$C_LIGHT_GREEN\h$C_WHITE:$C_YELLOW\w$C_LIGHT_GRAY$ $C_CLEAR"
# ccze is amazing
function free() {
command free $@ | ccze -A
}
function df() {
command df $@ | ccze -A
}
function ll() {
command ll $@ | ccze -A
}
function last {
command last $@ | ccze -A
}
# Colored logs
journalctl() {
command journalctl --no-pager $@ | ccze -A | less -R
}
# Don't autocomplete nothing (no grammar error)
shopt -s no_empty_cmd_completion
# Fix history for multiple shell sessions. Maybe.
shopt -s histappend
# Functions for fixing permissions
chmodd() {
find $2 -type d -exec chmod $1 {} +
}
chmodf() {
find $2 -type f -exec chmod $1 {} +
}
activate() {
source $1/bin/activate
}
# Utility functions
repeat() {
local i n
n=$1; shift
for i in $(seq $n); do
eval "$@"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment