Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View .bashrc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
# Bash-configuration for user
 
# Check for an interactive session
[ -z "$PS1" ] && return
 
## Settings ##
 
set_prompt_style () { # Custom prompt
local bldpur='\e[1;35m' # Purple
local bldblu='\e[1;34m' # Blue
local bldblk='\e[1;30m' # Black - Bold
local bldred='\e[1;31m' # Red
local txtrst='\e[0m' # Text Reset
#local bashuser="\[$bldpur\]\u@\[$txtrst\]" # username
local bashhost="\[$bldpur\]\h\[$txtrst\]" # hostname
local bashdir="\[$bldblu\]\w\[$txtrst\]" # directory
local bashprompt="\[$bldblk\]:\n\[$txtrst\]" # prompt symbol
if [ `whoami` == "root" ] ; then
# local bashuser="\[$bldred\]\u@\[$txtrst\]"
local bashhost="\[$bldred\]\h\[$txtrst\]"
fi
PS1="$bashuser$bashhost $bashdir$bashprompt"
if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then
PS1="$bashuser$bashhost(chroot) $bashdir$bashprompt"; fi
}
set_prompt_style
PROMPT_COMMAND='echo -ne "$bashuser$bashhost $bashdir$bashprompt"'
 
# History file: http://tinyurl.com/lvtonry, http://tinyurl.com/q4dvgek
# HS: history command limit in active session (saved in mem. [def.: 500])
# HFS: history command limit in history file
# HC: erase previous matching duplicates
# hst: append entries instead of overwriting
# PC: add command to history after executing
HISTSIZE=5000
HISTFILESIZE=20000
HISTCONTROL=erasedups
shopt -s histappend
PROMPT_COMMAND='history -a'
 
# Autocorect 'cd' mis-spellings
shopt -s cdspell
# Extended pattern matching features
#shopt -s extglob
# Hostname expansion
#shopt -s hostcomplete
 
# Bash completion extended (single press on partial or no-completion)
set show-all-if-ambiguous on
# Redirected output will not overwrite files
#set -o noclobber
 
# Allow 'less' to view non-text files (i.e. compressed files)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
 
# 'ls' colors
eval $(dircolors -b)
 
# 'grep' colors
alias grep='grep --color=auto'
export GREP_COLOR="1;37" # white
 
# Less Colors for Man Pages
if [[ ${TERM} == "xterm" ]]; then
export LESS_TERMCAP_md=$'\e[01;38;5;74m' # bold mode - main (cyan)
export LESS_TERMCAP_us=$'\e[38;5;97m' # underline mode - second (purp)
export LESS_TERMCAP_so=$'\e[38;5;252m' # standout-mode - info/find (gray)
export LESS_TERMCAP_mb=$'\e[01;31m' # begin blinking - unused? (red)
export LESS_TERMCAP_ue=$'\e[0m' # end underline
export LESS_TERMCAP_se=$'\e[0m' # end standout-mode
export LESS_TERMCAP_me=$'\e[0m' # end all mode - txt rest
else
export LESS_TERMCAP_md=$'\e[01;34m'
export LESS_TERMCAP_us=$'\e[01;35m'
export LESS_TERMCAP_so=$'\e[01;30m'
export LESS_TERMCAP_mb=$'\e[01;31m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_me=$'\e[0m'
fi
 
# Script directory
scrpt_dir=$HOME/.local/bin
 
# Path
export PATH="$scrpt_dir:$scrpt_dir/arch:$scrpt_dir/bugfixes:$scrpt_dir/others:$scrpt_dir/root:$scrpt_dir/backup:$scrpt_dir/root/testing:$scrpt_dir/testing:$PATH"
 
## Aliases ##
 
# Bash Navigation/Tools
alias ls='ls --color=auto --group-directories-first' # add color, group dir
alias ls1='ls -1' # sort by line
alias lsd='ls -lAtrh' # sort by date
alias lsl='ls -lAh' # long list, human-readabl
alias lss='ls -shAxSr' # sort by size
alias lsx='ls -lAhX' # sort by extension
alias treeview='tree -C | less -R' # tree directory w/ pager
alias ebash="v ~/.bashrc"
alias sbash="source ~/.bashrc"
 
# Shortcuts
if [[ "$(whoami)" == "root" ]]; then
alias cds="cd $scrpt_dir/root && ls -h"
else
alias cds="cd $scrpt_dir && ls -h"; fi
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias cdd="cd ~/Desktop && ls -h"
alias cdp="cd ~/.local/arbld"
alias cdt="cd ~/.local/share/Trash/files && ls -h"
alias cdv="cd ~/Videos"
 
# System
alias chot="sudo chown -R todd:users"
alias chx="chmod +x"
alias cron="crontab -e"
alias rcron="su -c $(printf "%q " "crontab -e")"
alias pn="ping -c2 archlinux.org"
 
# Programs
alias d="define"
alias g="bgcmd gedit"
alias rg="bgcmd gksudo gedit"
alias iotop="sudo iotop" # iotop now requires root access
alias lessq="less -R"
alias pasteit="gist -a"
alias v="vim -p"
alias vi="vim -p"
alias vim="vim -p"
alias sv="sudo vim -p" # open in tab
alias wget="wget -c" # always try to resume download first
 
## functions ##
abacus () { awk "BEGIN { print $* ; }"; }
#ad () { pwd > ~/.config/ad ;}
#bd () { cd "$(cat ~/.config/ad)" ;}
pdfcat () {
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
-sOutputFile=concatenated.pdf "$@" ;}
youple () {
mplayer -cache 200 -really-quiet $(youtube-dl -g --max-quality mp4 "$@" ) ;}
 
## Bash-completion ##
complete -W "`awk '{ print $2 }' /etc/hosts`" ssh
complete -cf sudo
complete -cf gksu
complete -cf bgcmd
 
## Other ##
 
# Package lookup (if get: command not found)
#source /usr/share/doc/pkgfile/command-not-found.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.