Skip to content

Instantly share code, notes, and snippets.

@theironsamurai
Last active May 23, 2020 22:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theironsamurai/deddc381310cb8b54c2c to your computer and use it in GitHub Desktop.
Save theironsamurai/deddc381310cb8b54c2c to your computer and use it in GitHub Desktop.
Ubuntu .bash_aliases
# Bash_Aliases on Ubuntu
export ALTERNATE_EDITOR="emacs"
export EDITOR="emacsclient -t"
# Haskell
# export PATH="$HOME/.cabal/bin":$PATH
# Clojure
# export PATH="$HOME/.lein":$PATH
# ClojureScript
# export CLOJURESCRIPT_HOME=$HOME/clojurescript
# Python
# export WORKON_HOME=$HOME/.virtualenvs
# export PROJECT_HOME=$HOME/snakepit
# source /usr/bin/virtualenvwrapper.sh
# Ruby Paths
# export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# PATH="`ruby -e 'puts Gem.user_dir'`/bin:$PATH"
# Tell Bundler to install Gems (on Arch) to the user dir
# export GEM_HOME=$(ruby -e 'puts Gem.user_dir')
# Tab completion for RVM
# [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
# NVM
# if [ -s ~/.nvm/nvm.sh ]; then
# NVM_DIR=~/.nvm
# source ~/.nvm/nvm.sh
# fi
# Super-Spy Aliases!
alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias grep='grep --color=tty -d skip'
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias sbash="source .bashrc"
# Arch-Based Specific
alias pac="pacaur -S"
# Ubuntu-specific
alias ubi="sudo apt-get install"
alias ubi-up="sudo apt-get update"
alias ubi-upg="sudo apt-get upgrade"
alias ubi-upd="sudo apt-get dist-upgrade"
alias ubi-add="sudo add-apt-repository"
# Emacs
alias etp='emacsclient -t PKGBUILD'
alias et="emacsclient -t"
alias ec="emacsclient -c"
alias demacs="emacs --daemon"
alias kemacs="emacsclient -e '(kill-emacs)'"
alias etb="et .bashrc"
alias E="SUDO_EDITOR=\"emacsclient -t -a emacs\" sudoedit"
# iPython
alias etip="et ~/.config/ipython/profile_default/ipython_config.py"
alias etipn="et ~/.config/ipython/profile_default/ipython_notebook_config.py"
alias ipn="ipython notebook"
alias ipc="nbconvert"
alias ipm="nbconvert --to markdown"
# Dir
alias cdhome="cd ~/"
alias cdh="cd ~/"
alias cdw="cd ~/writing"
alias cdb="cd .."
alias cdbb="cd ../.."
alias cdbbb="cd ../../.."
alias cdbbbb="cd ../../../.."
alias cdscribe="cd ~/.emacs.d/personal"
# Jekyll
# alias jsw="jekyll serve -w"
# Git
alias gitlazy="git add --all && git commit -m 'lazy commit' && git push"
# ex - archive extractor
# usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# CUSTOM BASH COLOR PROMPT
# 30m - Black
# 31m - Red
# 32m - Green
# 33m - Yellow
# 34m - Blue
# 35m - Purple
# 36m - Cyan
# 37m - White
# 0 - Normal
# 1 - Bold
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
export PS1="\n$CYAN\T\n$GREENBOLD \u$YELLOWBOLD@$PURPLEBOLD\h\[\033[00m\]:$CYANBOLD[\w]\[\033[00m\] \\$ "
}
prompt
# Auto load Screenfetch (just uncomment once you've installed it)
# NOTE: on Fedora, you'll need to install 'screenfetch-dev', rather than
# just 'screenfetch' on Arch and Ubuntu
screenfetch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment