Advertisement
Guest User

Untitled

a guest
May 11th, 2011
1,043
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.26 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. # Pager
  6. #export PAGER=most
  7.  
  8. # If not running interactively, don't do anything
  9. [ -z "$PS1" ] && return
  10.  
  11. # don't put duplicate lines in the history. See bash(1) for more options
  12. # don't overwrite GNU Midnight Commander's setting of `ignorespace'.
  13. HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
  14. # ... or force ignoredups and ignorespace
  15. HISTCONTROL=ignoreboth
  16.  
  17. # append to the history file, don't overwrite it
  18. shopt -s histappend
  19.  
  20. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  21.  
  22. # check the window size after each command and, if necessary,
  23. # update the values of LINES and COLUMNS.
  24. shopt -s checkwinsize
  25.  
  26. # make less more friendly for non-text input files, see lesspipe(1)
  27. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  28.  
  29. # set variable identifying the chroot you work in (used in the prompt below)
  30. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  31.     debian_chroot=$(cat /etc/debian_chroot)
  32. fi
  33.  
  34. # set a fancy prompt (non-color, unless we know we "want" color)
  35. case "$TERM" in
  36.     xterm-color) color_prompt=yes;;
  37. esac
  38.  
  39. # uncomment for a colored prompt, if the terminal has the capability; turned
  40. # off by default to not distract the user: the focus in a terminal window
  41. # should be on the output of commands, not on the prompt
  42. force_color_prompt=yes
  43.  
  44. if [ -n "$force_color_prompt" ]; then
  45.     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  46.     # We have color support; assume it's compliant with Ecma-48
  47.     # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  48.     # a case would tend to support setf rather than setaf.)
  49.     color_prompt=yes
  50.     else
  51.     color_prompt=
  52.     fi
  53. fi
  54.  
  55. if [ "$color_prompt" = yes ]; then
  56.     PS1='\[\e[0;34m\]┌──[\[\e[0;32m\]\u\[\e[0;31m\]@\[\e[0;35m\]\h\[\e[0;34m\]]──\[\e[0;34m\][\[\e[0;32m\]\w\[\e[0;34m\]] \n└── \[\e[0;34m\]'
  57. else
  58.     PS1='┌────[\u@\h]────────────────────────────────────────[\t]────┐ \n└───>[${PWD}] \$ '
  59. fi
  60. unset color_prompt force_color_prompt
  61.  
  62. # If this is an xterm set the title to user@host:dir
  63. case "$TERM" in
  64. xterm*|rxvt*)
  65.     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  66.     ;;
  67. *)
  68.     ;;
  69. esac
  70.  
  71. # Alias definitions.
  72. # You may want to put all your additions into a separate file like
  73. # ~/.bash_aliases, instead of adding them here directly.
  74. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  75.  
  76. #if [ -f ~/.bash_aliases ]; then
  77. #    . ~/.bash_aliases
  78. #fi
  79.  
  80. # enable color support of ls and also add handy aliases
  81. if [ -x /usr/bin/dircolors ]; then
  82.     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  83.     #alias ls='ls --color=auto'
  84.     #alias dir='dir --color=auto'
  85.     #alias vdir='vdir --color=auto'
  86.  
  87.     #alias grep='grep --color=auto'
  88.     #alias fgrep='fgrep --color=auto'
  89.     #alias egrep='egrep --color=auto'
  90. fi
  91.  
  92. # some more ls aliases
  93. #alias ll='ls -l'
  94. #alias la='ls -A'
  95. alias l='ls -CF'
  96. alias install='sudo apt-get install'
  97. alias update='sudo apt-get update'
  98. alias upgrade='sudo apt-get -u upgrade'
  99. alias agi='sudo apt-get install'
  100. alias agu='sudo apt-get update'
  101. alias agg='sudo apt-get -u upgrade'
  102.  
  103. # personal aliases
  104. alias ls='ls -hF --color'    # add colors for filetype recognition
  105. alias lx='ls -lXB'        # sort by extension
  106. alias lk='ls -lSr'        # sort by size
  107. alias la='ls -Al'        # show hidden files
  108. alias lr='ls -lR'        # recursice ls
  109. alias lt='ls -ltr'        # sort by date
  110. alias lm='ls -al |more'        # pipe through 'more'
  111. alias ll='ls -l'        # long listing
  112. alias lsize='ls --sort=size -lhr' # list by size
  113. alias lsd='ls -l | grep "^d"'   #list only directories
  114. alias lalf='ls -alF'
  115. alias acyl='cd ~/.icons/ACYL_Icon_Theme_0.9.3/ && bash AnyColorYouLike'
  116. alias reboot='sudo shutdown -r now'
  117. alias shutdown='sudo shutdown -h now'
  118.  
  119. #Command substitution
  120. alias h='history | grep $1'
  121. alias rm='rm -i'
  122. alias cp='cp -v -i'
  123. alias mv='mv -i'
  124. alias which='type -all'
  125. alias ..='cd ..'
  126.  
  127. # Creates an archive from given directory
  128. mktar() { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
  129. mktgz() { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
  130. mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
  131.  
  132. ### FUNCTIONS
  133.  
  134. # Easy extract
  135. # uncompress depending on extension...
  136. extract() {    
  137.   if [ -f "$1" ] ; then
  138.     case "$1" in
  139.       *.tar.bz2) tar xvjf "$1"   ;;
  140.       *.tar.gz)  tar xvzf "$1"   ;;
  141.       *.bz2)     bunzip2 "$1"    ;;
  142.       *.rar)     unrar x "$1"    ;;
  143.       *.gz)      gunzip "$1"     ;;
  144.       *.tar)     tar xvf "$1"    ;;
  145.       *.tbz2)    tar xvjf "$1"   ;;
  146.       *.tgz)     tar xvzf "$1"   ;;
  147.       *.zip)     unzip "$1"      ;;
  148.       *.Z)       uncompress "$1" ;;
  149.       *.7z)      7z x "$1"       ;;
  150.       *)
  151.       echo "'$1' cannot be extracted"
  152.       return 1
  153.       ;;
  154.     esac
  155.   else
  156.     echo "'$1' is not a valid file"
  157.     return 1
  158.   fi
  159.   return 0
  160. }
  161.  
  162.  
  163.  
  164. # enable programmable completion features (you don't need to enable
  165. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  166. # sources /etc/bash.bashrc).
  167. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  168.     . /etc/bash_completion
  169. fi
  170.  
  171.  
  172. #------------------------------------------////
  173. # Colors:
  174. #------------------------------------------////
  175. black='\e[0;30m'
  176. blue='\e[0;34m'
  177. green='\e[0;32m'
  178. cyan='\e[0;36m'
  179. red='\e[0;31m'
  180. purple='\e[0;35m'
  181. brown='\e[0;33m'
  182. lightgray='\e[0;37m'
  183. darkgray='\e[1;30m'
  184. lightblue='\e[1;34m'
  185. lightgreen='\e[1;32m'
  186. lightcyan='\e[1;36m'
  187. lightred='\e[1;31m'
  188. lightpurple='\e[1;35m'
  189. yellow='\e[1;33m'
  190. white='\e[1;37m'
  191. nc='\e[0m'
  192.  
  193. #!/bin/bash
  194. # Term Colors
  195.  
  196. FGNAMES=('▐▐▐' '▐▐▐' '▐▐▐' '▐▐▐' '▐▐▐' '▐▐▐' '▐▐▐' '▐▐▐')
  197. BGNAMES=('  ')
  198.  
  199. for b in $(seq 0 0); do
  200.     if [ "$b" -gt 0 ]; then
  201.       bg=$(($b+39))
  202.     fi
  203. #echo -en "\033[0m ${BGNAMES[$b]}"
  204. echo
  205.     for f in $(seq 0 7); do
  206.       echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} "
  207.       echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} "
  208.     done
  209. echo
  210.   echo -e "\033[0m"  
  211. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement