| 1 | # set variable identifying the chroot you work in (used in the prompt below) |
| 2 | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then |
| 3 | debian_chroot=$(cat /etc/debian_chroot) |
| 4 | fi |
| 5 | |
| 6 | # set a fancy prompt (non-color, unless we know we "want" color) |
| 7 | case "$TERM" in |
| 8 | xterm-color) color_prompt=yes;; |
| 9 | esac |
| 10 | |
| 11 | # uncomment for a colored prompt, if the terminal has the capability; turned |
| 12 | # off by default to not distract the user: the focus in a terminal window |
| 13 | # should be on the output of commands, not on the prompt |
| 14 | force_color_prompt=yes |
| 15 | |
| 16 | if [ -n "$force_color_prompt" ]; then |
| 17 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |
| 18 | # We have color support; assume it's compliant with Ecma-48 |
| 19 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |
| 20 | # a case would tend to support setf rather than setaf.) |
| 21 | color_prompt=yes |
| 22 | else |
| 23 | color_prompt= |
| 24 | fi |
| 25 | fi |
| 26 | |
| 27 | if [ "$color_prompt" = yes ]; then |
| 28 | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) \u@\h \e[32m[\w]\e[0m\n$ ' |
| 29 | else |
| 30 | PS1='${debian_chroot:+($debian_chroot)}($SHLVL) u@h [w]\n$ ' |
| 31 | fi |
| 32 | unset color_prompt force_color_prompt |
| 33 | |
| 34 | case "$TERM" in |
| 35 | xterm*|rxvt*) |
| 36 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1";; |
| 37 | *) |
| 38 | ;; |
| 39 | esac |
| 40 | |
| 41 | # enable color support of ls and also add handy aliases |
| 42 | if [ -x /usr/bin/dircolors ]; then |
| 43 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" |
| 44 | alias ls='ls --color=auto' |
| 45 | alias dir='dir --color=auto' |
| 46 | alias vdir='vdir --color=auto' |
| 47 | |
| 48 | alias grep='grep --color=auto' |
| 49 | alias fgrep='fgrep --color=auto' |
| 50 | alias egrep='egrep --color=auto' |
| 51 | fi |
| 52 | |
| 53 | alias nano='nano --nowrap --smooth -T 4' |
| 54 | alias please='sudo' |
| 55 | |
| 56 | function findinfiles() { find ./ -type f -print0 | xargs -0 grep -i "$1"; } |
| 57 | function findinphpfiles() { find ./ -type f -name "*.php" -print0 | xargs -0 grep -i "$1"; } |
| 58 | |
| 59 | complete -W "$(echo $(grep '^ssh ' ~/.bash_history | sort -u | sed 's/^ssh //'))" ssh |
| 60 |
willpower232 / bash.bashrc
Last active 1 month ago
I am making my .bashrc portable as inspired by this https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html
Revision b8d0381fc005fcfd68b56936c88c9ad23af1a8c6