irenegr

.bashrc sabayon

Jan 16th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.93 KB | None | 0 0
  1. # ~/.bashrc: executed by bash(1) for non-login shells.
  2. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3. # for examples
  4.  
  5. # colors & char ########################################################
  6. # text normal colors
  7. red='\e[0;31m'
  8. blue='\e[0;34m'
  9. cyan='\e[0;36m'
  10. green='\e[0;32m'
  11. yellow='\e[0;33m'
  12. # text bright colors
  13. bred='\e[0;91m'
  14. bblue='\e[0;94m'
  15. bcyan='\e[0;96m'
  16. bgreen='\e[0;92m'
  17. byellow='\e[0;93m'
  18. bwhite='\e[0;97m'
  19. # reset color
  20. NC='\e[0m'
  21.  
  22. # alias ################################################################
  23. # ls & grep ------------------------------------------------------------
  24. alias ls='ls --color=auto'
  25. alias dir='dir --color=auto'
  26. alias vdir='vdir --color=auto'
  27. alias grep='grep --color=auto'
  28. alias fgrep='fgrep --color=auto'
  29. alias egrep='egrep --color=auto'
  30. alias ll='ls -l'
  31. alias la='ls -A'
  32. alias l='ls -CF'
  33. # cd & goto ------------------------------------------------------------
  34. alias cd..='cd ..'
  35. alias ...='cd ..'
  36. alias ....='cd ../..'
  37. alias gm='cd /media'
  38. alias gc='cd ~/.config'
  39. alias gb='cd ~/bin'
  40. # apps -----------------------------------------------------------------
  41. # agenda/todo list
  42. alias agenda='urxvtcd -T agenda -e calcurse'
  43. # may the force be with you
  44. alias starwars="telnet towel.blinkenlights.nl"
  45. # utils ----------------------------------------------------------------
  46. # get top 10 shell commands:
  47. alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
  48. # process using web
  49. alias ports='lsof -i -n -P'
  50. # last modified files and folders
  51. alias mod60="find /home/$USER/ -path /home/$USER/.thumbnails -prune -o -path /home/$USER/.mozilla -prune -o -mmin -60"
  52. alias modd="find /home/$USER/ -path /home/$USER/.thumbnails -prune -o -path /home/$USER/.mozilla -prune -o -mtime -1"
  53. # make parent directory if needed
  54. alias mkdir='mkdir -p'
  55. # packages -------------------------------------------------------------
  56. alias debup='sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean'
  57. alias debsh='apt-cache search'
  58. alias debvs='apt-cache policy'
  59. alias debcl='sudo apt-get clean'
  60. alias debin='sudo apt-get --no-install-recommends install'
  61. alias debrm='sudo apt-get autoremove --purge'
  62. alias debgui='gksudo synaptic'
  63. # quit, exit & reboot --------------------------------------------------
  64. alias :q='exit'
  65. alias oust='echo "bye $USER..."; sleep 2s && sudo shutdown -h now'
  66. alias comeback='echo "be back right now..."; sleep 2s && sudo shutdown -r now'
  67. # bash cfg -------------------------------------------------------------
  68. alias bcfg='vim ~/.bashrc'
  69. alias brld='source ~/.bashrc'
  70. # end of alias #########################################################
  71.  
  72. # functions ############################################################
  73. # misc -----------------------------------------------------------------
  74. # find from name in current directory
  75. function ff() { find . -type f -iname '*'$*'*' -ls ; }
  76. # generate a dated .bak from file
  77. function bak() { cp $1 $1_`date +%Y-%m-%d_%H:%M:%S`.bak ; }
  78. # minical
  79. function today() { echo -n "Today's date is:\n"; date +"%A, %B %-d, %Y"; }
  80. # infos ----------------------------------------------------------------
  81. # generate space report
  82. function space() { du -skh * | sort -hr ; }
  83. # disk usage
  84. function dduse() { echo -e " `df -h | grep 'rootfs ' | awk '{print $5}'` used -- `df -h | grep 'rootfs ' | awk '{print $4}'` free"; }
  85. # mem usage
  86. function mmuse() { echo -e " `free -m | grep buffers/cache | awk '{print $3}'`M used -- `free -m | grep buffers/cache | awk '{print $4}'`M free"; }
  87. # processes
  88. function my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; }
  89. function pp() { my_ps f | awk '!/awk/ && $0~var' var=${1:-".*"} ; }
  90. # hardware -------------------------------------------------------------
  91. # processor
  92. function core() { cat /proc/cpuinfo | grep "model name" | cut -c14- ; }
  93. # graphic card
  94. function graph() { lspci | grep -i vga | cut -d: -f3 ; }
  95. # ethernet card
  96. function ethcard() { lspci | grep -i ethernet | cut -d: -f3 ; }
  97. # wireless card
  98. function wfcard() { lspci | grep -i network | cut -d: -f3 ; }
  99. # public ip address ----------------------------------------------------
  100. function my_eip()
  101. {
  102. if [ "$(cat /sys/class/net/eth0/operstate)" = "up" ] || [ "$(cat /sys/class/net/eth1/operstate)" = "up" ] || [ "$(cat /sys/class/net/wlan0/operstate)" = "up" ];then
  103. MY_EXIP=$(wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g')
  104. else
  105. MY_EXIP=$(echo "not connected")
  106. fi
  107. # output
  108. echo -e " $MY_EXIP"
  109. }
  110. # infobox --------------------------------------------------------------
  111. function ii()
  112. {
  113. echo
  114. echo -e ""
  115. echo -e "${cyan} livarp_0.4 Debian InfoBox"
  116. echo -e " -------------------------$NC"
  117. echo -e "${blue} agenda$NC"
  118. echo -e " `date +'%A, %B %-d, %Y -- %I:%M %P'`"
  119. echo -e "${blue} processor information$NC"
  120. echo -e " `core`"
  121. echo -e "${blue} graphic information$NC"
  122. echo -e "`graph`"
  123. echo -e "${blue} ethernet information$NC"
  124. echo -e "`ethcard`"
  125. echo -e "${blue} wireless information$NC"
  126. echo -e "`wfcard`"
  127. echo ""
  128. echo -e "${yellow} kernel information$NC"
  129. echo -e " `uname -a`"
  130. echo -e "${yellow} machine stats$NC"
  131. echo -e "`uptime`"
  132. echo -e "${yellow} memory stats$NC"
  133. echo -e "`mmuse`"
  134. echo -e "${yellow} disk stats$NC"
  135. echo -e "`dduse`"
  136. echo -e "${yellow} external IP address$NC"
  137. echo -e "`my_eip`"
  138. echo -e ""
  139. echo -e "${blue} if R.Stallman was here...$NC"
  140. echo -e "`vrms`"
  141. echo ""
  142. }
  143. # archives -------------------------------------------------------------
  144. # extract
  145. function extract()
  146. {
  147. if [ -f $1 ] ; then
  148. case $1 in
  149. *.tar.bz2) tar xvjf $1 ;;
  150. *.tar.gz) tar xvzf $1 ;;
  151. *.bz2) bunzip2 $1 ;;
  152. *.rar) unrar x $1 ;;
  153. *.gz) gunzip $1 ;;
  154. *.tar) tar xvf $1 ;;
  155. *.tbz2) tar xvjf $1 ;;
  156. *.tgz) tar xvzf $1 ;;
  157. *.zip) unzip $1 ;;
  158. *.Z) uncompress $1 ;;
  159. *.7z) 7z x $1 ;;
  160. *.xz) unxz $1 ;;
  161. *) echo "'$1' cannot be extracted via >extract<" ;;
  162. esac
  163. else
  164. echo "'$1' is not a valid file"
  165. fi
  166. }
  167. # compress
  168. mktar() { tar cvf "${1%%/}.tar" "${1%%/}/"; }
  169. mktgz() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
  170. mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
  171. mktxz() { tar cvJf "${1%%/}.tar.xz" "${1%%/}/"; }
  172. # end of functions #####################################################
  173.  
  174. # If not running interactively, don't do anything
  175. case $- in
  176. *i*) ;;
  177. *) return;;
  178. esac
  179.  
  180. # don't put duplicate lines or lines starting with space in the history.
  181. # See bash(1) for more options
  182. HISTCONTROL=ignoreboth
  183.  
  184. # append to the history file, don't overwrite it
  185. shopt -s histappend
  186.  
  187. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  188. HISTSIZE=1000
  189. HISTFILESIZE=2000
  190.  
  191. # check the window size after each command and, if necessary,
  192. # update the values of LINES and COLUMNS.
  193. shopt -s checkwinsize
  194.  
  195.  
  196. # If set, the pattern "**" used in a pathname expansion context will
  197. # match all files and zero or more directories and subdirectories.
  198. #shopt -s globstar
  199.  
  200. # make less more friendly for non-text input files, see lesspipe(1)
  201. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  202.  
  203. # set variable identifying the chroot you work in (used in the prompt below)
  204. if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
  205. debian_chroot=$(cat /etc/debian_chroot)
  206. fi
  207.  
  208. # set a fancy prompt (non-color, unless we know we "want" color)
  209. case "$TERM" in
  210. xterm-color) color_prompt=yes;;
  211. esac
  212.  
  213. # prompt ###############################################################
  214. # uncomment for a colored prompt, if the terminal has the capability; turned
  215. # off by default to not distract the user: the focus in a terminal window
  216. # should be on the output of commands, not on the prompt
  217. force_color_prompt=yes
  218.  
  219. if [ -n "$force_color_prompt" ]; then
  220. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  221. # We have color support; assume it's compliant with Ecma-48
  222. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  223. # a case would tend to support setf rather than setaf.)
  224. color_prompt=yes
  225. else
  226. color_prompt=
  227. fi
  228. fi
  229.  
  230. if [ "$color_prompt" = yes ]; then
  231. # uncomment for 'livarp' prompt
  232. #echo -en "\e[1;37mlivarp\e[m0.4\e[0;32mGNU/Linux\e[01;34mDebian\e[m\n"
  233. PS1='${debian_chroot:+($debian_chroot)} \e[01;32m\u\e[m@\e[0;36m\h\e[m \e[01;34m\w\e[m\n $ '
  234. # uncomment for a guantas_style prompt. sources: http://crunchbang.org/forums/viewtopic.php?pid=277970#p277970
  235. #PS1="\[\e[00;32m\]\A \[\e[00;35m\]\[\e[00;37m\]\n\[\e[00;35m\]●\[\e[00;33m\] ●\[\e[00;31m\] ●\[\e[01;35m\]\[\e[0m\] "
  236. # regular Debian colored prompt:
  237. #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  238. else
  239. PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  240. fi
  241. unset color_prompt force_color_prompt
  242.  
  243. # enable programmable completion features (you don't need to enable
  244. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  245. # sources /etc/bash.bashrc).
  246. if ! shopt -oq posix; then
  247. if [ -f /usr/share/bash-completion/bash_completion ]; then
  248. . /usr/share/bash-completion/bash_completion
  249. elif [ -f /etc/bash_completion ]; then
  250. . /etc/bash_completion
  251. fi
  252. fi
  253.  
  254.  
  255. export EDITOR="geany"
  256. export BROWSER="chromium"
  257. export PAGER="most"
  258. export PROMPT_COMMAND='echo -ne "\033]0;0mg 4 ch1x0r\007"'
  259. export PATH=/home/fog/bin:$PATH
  260.  
  261. alias add='cd ~/fogland && git add *'
  262. alias commit='git commit -m 'reinitialized\files''
  263. alias push='git push https://github.com/irenegr/fogland'
  264. alias pull='git pull https://github.com/irenegr/fogland'
  265. alias ei='sudo equo install'
  266. alias er='sudo equo remove'
  267. alias ec='sudo equo cleanup'
  268.  
  269. #alias starwars="telnet towel.blinkenlights.nl"
  270.  
  271. #PS1="\[\e[00;31m\]●\[\e[00;32m\] ●\[\e[00;33m\] ● \[\e[00;35m\]\w $ \[\e[0m\]"
  272.  
  273. #PS1="\[\e[00;31m\]●\[\e[00;35m\] ●\[\e[00;33m\] ●\[\e[00;32m\] ●\[\e[00;36m\] ●\[\e[00;34m\] ● \[\e[33m\] \w \[\e[0m\]"
  274.  
  275. #PS1="\[\e[00;36m\] \A \[\e[00;35m\] f\[\e[00;33m\]o\[\e[00;32m\]g\n\[\e[00;35m\]●\[\e[00;33m\] ●\[\e[00;31m\] ●\[\e[00;36m\] ●\[\e[00;32m\] ●\[\e[00;34m\] ● \[\e[0m\]\w \[\e[0m\]$ "
  276.  
  277. #PS1="\[\e[00;32m\]\A \[\e[00;35m\]\[\e[00;37m\]\n\[\e[00;35m\]●\[\e[00;33m\] ●\[\e[00;31m\] ●\[\e[01;35m\]\[\e[0m\] "
  278.  
  279. PS1='\[\e[41m\]\[\e[1;37m\] \u \[\e[1;37m\]\[\e[46m\] \w \[\e[0m\]\[\e[1;37m\]\[\e[42m\] \h \[\e[0m\] '
  280.  
  281. #PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]"
  282.  
  283. #PS1="\[\e[0;34m\]┌─[\[\e[0;31m\u\e[0;34m\]]──[\[\e[0;32m\]${HOSTNAME%}\[\e[0;34m\]]\[\e[0;33m\]:\w$\[\e[0;34m\]\n\[\e[0;34m\]└──\[\e[0;34m\]>\[\e[0m\]"
  284.  
  285. #PS1='\[\033[0;32m\]┌┼─┼─ \[\033[0m\033[0;32m\]\u\[\033[0m\] @ \[\033[0;36m\]\h\[\033[0m\033[0;32m\] ─┤├─ \[\033[0m\]\t \d\[\033[0;32m\] ─┤├─ \[\033[0;31m\]\w\[\033[0;32m\] ─┤ \n\[\033[0;32m\]└┼─\[\033[0m\033[0;32m\]\$\[\033[0m\033[0;32m\]─┤▶\[\033[0m\] '
  286.  
  287. #PS1="\[\e[0;33m\]┌─[\[\e[0;31m\u\e[0;33m\]]──[\[\e[0;34m\]${HOSTNAME%%.*}\[\e[0;33m\]]\[\e[0;33m\]:\w$\[\e[0;33m\]\n\[\e[0;33m\]└──\[\e[0;33m\]>>\[\e[0m\]"
  288.  
  289. #PS1='\[\033[1;32m\]├─\[\033[0m\033[1;31m\] \u\[\033[0m\] @ \[\033[;34m\]\h\[\033[0m\033[1;32m\] ─┤├─ \[\033[0m\033[1;37m\]\t \D{%a %e %b} \[\033[1;32m\]─┤├─ \[\033[1;36m\]\w\[\033[1;32m\] ─┤ \n\[\033[1;32m\]├─ \[\033[0m\033[1;31m\]\$\[\033[0m\033[1;32m\]─┤:\[\033[0m\] '
  290.  
  291. #PS1='\[\033[1;32m\]├─\[\033[0m\033[1;31m\] \u\[\033[0m\] @ \[\033[1;35m\]\h\[\033[0m\033[1;32m\] ─┤├─ \[\033[0;33m\]\w\[\033[1;32m\] ─┤ \[\033[1;32m\]├─ \[\033[0m\033[0;35m\]\$\[\033[0m\033[1;32m\] ─┤:\[\033[0m\] '
  292.  
  293. #PS1="\n\[\033[30;1m\]/ \[\033[31;1m\](\[\033[1m\]\[\033[35m\]\u\[\033[30;1m\]@\[\033[1m\]\[\033[35m\]\H\[\033[31;1m\])\[\033[30;1m\]\[\033[30;1m\] \ \n\[\033[30;1m\] \[\033[31;1m\](\[\033[1m\]\[\033[37m\]\w\[\033[31;1m\]) \[\033[30;1m\]-\[\033[31;1m\]> \[\033[1m\]\e[m"
  294.  
  295. #PS1="\[\033[0;32m\][\t]\h:\[\033[0;33m\]\w\n%\[\033[0;37;00m\]"
  296.  
  297. #PS1='\[\033[0;36m\][\[\033[0;33m\]\u\[\033[0;36m\]@\[\033[0;33m\]\h \[\033[0;34m\]\W\[\033[0;36m\]]\$\[\033[0m\] '
  298.  
  299. #PS1='\[\e[1;34m\]\u\[\e[m\] \[\e[1;35m\]\w\[\e[m\]\[\e[m\] \[\e[1;30m\]> \[\e[m\]\[\e[0;m\] '
  300.  
  301. #PS1=" \[\e[32;1m\][\h] \[\e[36m\]\w\[\e[0m\]\n \[\e[36;1m\]> "
  302.  
  303. #PS1='\[\e[0;31m\]\u\[\e[1;32m\] @ \[\e[0;34m\]\W \[\e[1;33m\]$ \[\e[0;37m\]'
Advertisement
Add Comment
Please, Sign In to add comment