Page 3 of 18 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 173

Thread: Show us your .bashrc!

  1. #21
    Join Date
    Aug 2006
    Location
    Poland
    Beans
    Hidden!

    Re: Show us your .bashrc!

    Quote Originally Posted by supertux View Post
    they arent there, can you re-upload them?
    Sorry for a long delay..
    /home/user/.bashrc http://pastebin.com/f628171ce
    /root/.bashrc http://pastebin.com/f5c1c0405

  2. #22
    Join Date
    Nov 2005
    Location
    Alberta, Canada
    Beans
    231

    Re: Show us your .bashrc!

    How about a zshrc? Most of this stuff will work in bash, anyhow.

    Code:
    # Compinstall generated options
    source $HOME/.config/zsh/compinstall
    
    # Options
    source $HOME/.config/zsh/environment
    
    # Prompt colours and style
    source $HOME/.config/zsh/prompt
    
    # Aliases
    source $HOME/.config/zsh/alias
    
    # Functions
    source $HOME/.config/zsh/function
    
    # Login options
    source $HOME/.config/zsh/zlogin
    
    # Keybinds
    source $HOME/.config/zsh/keys
    Okay, more seriously, here's a cat of the sourced files:

    Code:
    # The following lines were added by compinstall
    
    zstyle ':completion:*' completer _expand _complete _correct _approximate
    zstyle ':completion:*' completions 1
    zstyle ':completion:*' expand prefix suffix
    zstyle ':completion:*' format 'Completing %d'
    zstyle ':completion:*' glob 1
    zstyle ':completion:*' ignore-parents parent
    zstyle ':completion:*' insert-unambiguous true
    zstyle ':completion:*' list-colors ''
    zstyle ':completion:*' matcher-list '' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
    zstyle ':completion:*' max-errors 2
    zstyle ':completion:*' menu select=long
    zstyle ':completion:*' original true
    zstyle ':completion:*' preserve-prefix '//[^/]##/'
    zstyle ':completion:*' prompt 'Errors: %e'
    zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
    zstyle ':completion:*' substitute 1
    zstyle :compinstall filename '/home/avatar/.zshrc'
    
    autoload -Uz compinit
    compinit
    # End of lines added by compinstall
    # Lines configured by zsh-newuser-install
    HISTFILE=~/.config/zsh/histfile
    HISTSIZE=32000
    SAVEHIST=64000
    setopt appendhistory autocd
    unsetopt beep extendedglob nomatch notify
    bindkey -v
    # End of lines configured by zsh-newuser-install
    #
    ############
    #
    #  Environment Variables
    #
    
    export PATH=$PATH:$HOME/bin:/opt
    export PAGER='most'
    export MANPAGER='most'
    export MAILPATH=~/mail
    export EDITOR="vim"
    export WM="openbox"
    export GIMP2_DIRECTORY=$HOME/.config/gimp-2.4
    export MOST_INITFILE=$HOME/.config/most/mostrc
    export RXVT_SOCKET=/tmp
    export MPLAYER_HOME=$HOME/.config/mplayer
    export MAIL=$HOME/mail
    
    setopt MAIL_WARN
    
    # Dynamic Mailpath
    typeset -a mailpath
    for i in ~/mail/list/*(.); do
    	mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}."
    done
    
    #gpg-agent says it needs this
    export GPG_TTY='tty'
    
    #fortunes at each new shell
    #fortune -a
    
    ##################
    #
    # Zsh Keybindings
    #
    bindkey "\e[1~" beginning-of-line
    bindkey "\e[4~" end-of-line
    bindkey "\e[5~" beginning-of-history
    bindkey "\e[6~" end-of-history
    bindkey "\e[3~" delete-char
    bindkey "\e[2~" quoted-insert
    bindkey "\e[5C" forward-word
    bindkey "\eOc" emacs-forward-word
    bindkey "\e[5D" backward-word
    bindkey "\eOd" emacs-backward-word
    bindkey "\e\e[C" forward-word
    bindkey "\e\e[D" backward-word
    bindkey "^H" backward-delete-word
    # for rxvt
    bindkey "\e[8~" end-of-line
    bindkey "\e[7~" beginning-of-line
    # completion in the middle of a line
    bindkey '^i' expand-or-complete-prefix
    
    # unbind
    bindkey -r main '^['
    ############
    #
    # Functions
    #
    
    # lcfiles - Lowercase all files in the current directory
    lcfiles() {
    	print -n 'Really lowercase all files? (y/n) '
    	if read -q ; then
    		for i in * ; do
    			mv $i $i:l
    	done
    	fi
    }
    
    # Compression shortcuts
    
    #tar.gz
    tg() {
    	tarfile=$1
    	shift
    	tar -czvf $tarfile $@
    }
    
    #tar.bz2
    tb() {
    	tar --bzip2 -cvf $tarfile $@
    }
    
    # Extract various compression formats
    extract () {
         if [ -f $1 ] ; then
             case $1 in
                 *.tar.bz2)   tar xjf $1        ;;
                 *.tar.gz)    tar xzf $1     ;;
                 *.bz2)       bunzip2 $1       ;;
                 *.rar)       rar 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 extract()" ;;
             esac
         else
             echo "'$1' is not a valid file"
         fi
    }
    
    # Weather by us zip code - Can be called two ways # weather 50315 # weather "Des Moines"
    weather ()
    {
    declare -a WEATHERARRAY
    WEATHERARRAY=( `elinks -dump "http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=weather+${1}&btnG=Search" | grep -A 5 -m 1 "Weather for" | sed 's;\[26\]Add to iGoogle\[27\]IMG;;g'`)
    echo ${WEATHERARRAY[@]}
    }
    
    #copy and go to dir
    cpg (){
      if [ -d "$2" ];then
        cp $1 $2 && cd $2
      else
        cp $1 $2
      fi
    }
    
    #move and go to dir
    mvg (){
      if [ -d "$2" ];then
        mv $1 $2 && cd $2
      else
        mv $1 $2
      fi
    }
    
    #dirsize - finds directory sizes and lists them for the current directory
    dirsize ()
    {
    du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \
    egrep '^ *[0-9.]*[MG]' | sort -n > /tmp/list
    egrep '^ *[0-9.]*M' /tmp/list
    egrep '^ *[0-9.]*G' /tmp/list
    rm /tmp/list
    }
    
    #myip - finds your current IP if your connected to the internet
    myip ()
    {
    elinks -dump http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' 
    }
    
    #netinfo - shows network information for your system
    netinfo ()
    {
    echo "--------------- Network Information ---------------"
    /sbin/ifconfig | awk /'inet addr/ {print $2}'
    /sbin/ifconfig | awk /'Bcast/ {print $3}'
    /sbin/ifconfig | awk /'inet addr/ {print $4}'
    /sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
    myip=`elinks -dump http://checkip.dyndns.org:8245/ | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' `
    echo "${myip}"
    echo "---------------------------------------------------"
    }
    
    #bu - Back Up a file. Usage "bu filename.txt" 
    bu () { cp $1 ${1}-`date +%Y%m%d%H%M`.backup ; }
    
    # Pacman search colourised by repository
    psc() {
      echo -e "$(pacman -Ss $@ | sed \
           -e 's#core/.*#\\033[1;31m&\\033[0;37m#g' \
           -e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \
           -e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \
           -e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )"
    }
    
    ############
    #
    #  Prompt
    #
    
    function precmd {
    
        local TERMWIDTH
        (( TERMWIDTH = ${COLUMNS} - 1 ))
    
    
        ###
        # Truncate the path if it's too long.
        
        PR_FILLBAR=""
        PR_PWDLEN=""
        
        local promptsize=${#${(%):---(%n@%m:%l)---()--}}
        local pwdsize=${#${(%):-%~}}
        
        if [[ "$promptsize + $pwdsize" -gt $TERMWIDTH ]]; then
    	    ((PR_PWDLEN=$TERMWIDTH - $promptsize))
        else
    	PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize)))..${PR_HBAR}.)}"
        fi
    
    
        ###
        # Get APM info.
    
        if which ibam > /dev/null; then
    	PR_APM_RESULT=`ibam --percentbattery`
        elif which apm > /dev/null; then
    	PR_APM_RESULT=`apm`
        fi
    }
    
    
    setopt extended_glob
    preexec () {
        if [[ "$TERM" == "screen" ]]; then
    	local CMD=${1[(wr)^(*=*|sudo|-*)]}
    	echo -n "\ek$CMD\e\\"
        fi
    }
    
    
    setprompt () {
        ###
        # Need this so the prompt will work.
    
        setopt prompt_subst
    
    
        ###
        # See if we can use colors.
    
        autoload colors zsh/terminfo
        if [[ "$terminfo[colors]" -ge 8 ]]; then
    	colors
        fi
        for color in RED GREEN YELLOW BLUE MAGENTA BLUE WHITE; do
    	eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
    	eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
    	(( count = $count + 1 ))
        done
        PR_NO_COLOUR="%{$terminfo[sgr0]%}"
    
    
        ###
        # See if we can use extended characters to look nicer.
        
        typeset -A altchar
        set -A altchar ${(s..)terminfo[acsc]}
        PR_SET_CHARSET="%{$terminfo[enacs]%}"
        PR_SHIFT_IN="%{$terminfo[smacs]%}"
        PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
        PR_HBAR=${altchar[q]:--}
        PR_ULCORNER=${altchar[l]:--}
        PR_LLCORNER=${altchar[m]:--}
        PR_LRCORNER=${altchar[j]:--}
        PR_URCORNER=${altchar[k]:--}
    
        
        ###
        # Decide if we need to set titlebar text.
        
        case $TERM in
    	xterm*)
    	    PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
    	    ;;
    	screen)
    	    PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
    	    ;;
    	*)
    	    PR_TITLEBAR=''
    	    ;;
        esac
        
        
        ###
        # Decide whether to set a screen title
        if [[ "$TERM" == "screen" ]]; then
    	PR_STITLE=$'%{\ekzsh\e\\%}'
        else
    	PR_STITLE=''
        fi
        
        
        ###
        # APM detection
        
        if which ibam > /dev/null; then
    	PR_APM='$PR_RED${${PR_APM_RESULT[(f)1]}[(w)-2]}%%(${${PR_APM_RESULT[(f)3]}[(w)-1]})$PR_LIGHT_BLUE:'
        elif which apm > /dev/null; then
    	PR_APM='$PR_RED${PR_APM_RESULT[(w)5,(w)6]/\% /%%}$PR_LIGHT_BLUE:'
        else
    	PR_APM=''
        fi
        
        
        ###
        # Finally, the prompt.
    
        PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
    $PR_WHITE$PR_SHIFT_IN$PR_ULCORNER$PR_WHITE$PR_HBAR$PR_SHIFT_OUT(\
    $PR_YELLOW%(!.%SROOT%s.%n)$PR_YELLOW@%m:%l\
    $PR_WHITE)$PR_SHIFT_IN$PR_HBAR$PR_WHITE$PR_HBAR${(e)PR_FILLBAR}$PR_WHITE$PR_HBAR$PR_SHIFT_OUT(\
    $PR_YELLOW%$PR_PWDLEN<...<%~%<<\
    $PR_WHITE)$PR_SHIFT_IN$PR_HBAR$PR_WHITE$PR_URCORNER$PR_SHIFT_OUT\
    
    $PR_WHITE$PR_SHIFT_IN$PR_LLCORNER$PR_WHITE$PR_HBAR$PR_SHIFT_OUT(\
    %(?..$PR_LIGHT_YELLOW%?$PR_WHITE:)\
    ${(e)PR_APM}$PR_YELLOW%D{%H:%M}\
    $PR_LIGHT_WHITE:%(!.$PR_YELLOW.$PR_YELLOW)%#$PR_WHITE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
    $PR_WHITE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
    $PR_NO_COLOUR '
    
        RPROMPT=' $PR_WHITE$PR_SHIFT_IN$PR_HBAR$PR_WHITE$PR_HBAR$PR_SHIFT_OUT\
    ($PR_YELLOW%D{%a,%b%d}$PR_WHITE)$PR_SHIFT_IN$PR_HBAR$PR_WHITE$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'
    
        PS2='$PR_WHITE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
    $PR_WHITE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
    $PR_LIGHT_YELLOW%_$PR_WHITE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
    $PR_WHITE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
    }
    
    setprompt

  3. #23
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Show us your .bashrc!

    +1 zsh



    Click on link to see a screen shot of my login screen.

    ZSH :

    http://friedcpu.wordpress.com/2007/0...ull-ever-need/
    http://www.ibm.com/developerworks/li...l?dwzone=linux


    The other .bashrc threads :

    http://ubuntuforums.org/showthread.php?&t=204382

    http://www.ubuntuforums.org/showthread.php?t=161312

    And, to give credit where credit is due, we should all thank rezza at Arch Linux for that ex script, I posted it on the Ubuntu Forums here (scroll down a little):

    http://ubuntuforums.org/showpost.php...3&postcount=25
    Last edited by bodhi.zazen; February 4th, 2008 at 11:14 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #24
    Join Date
    Feb 2008
    Location
    MN
    Beans
    48
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Show us your .bashrc!

    Well, I am a newbie (like a matter of 3 days) so I haven't gotten into much customization, however I am sure I will in time, I did so with Litestep under windows. Though, I did have to post to this, because I laughed my *** off when I read this topic. The ultimate question is though, does one get tossed a beer when one shows them?

  5. #25
    Join Date
    Dec 2007
    Location
    turn arround ;)
    Beans
    250

    Re: Show us your .bashrc!

    still making mine

  6. #26
    Join Date
    Jun 2006
    Location
    Millau, France
    Beans
    1,492
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Show us your .bashrc!

    I thought it was impossible to have a bash prompt as fancy as zsh's ones, but I've found a way here's a screenshot of my bash prompt:

    The whole article is here :
    http://ayozone.org/2008/02/25/bash-f...d-improvments/
    and the bashrc file (you'll have to rename it) :
    http://ayozone.org/wp-content/upload.../02/bashrc.txt

  7. #27
    Join Date
    Oct 2007
    Beans
    0

    Re: Show us your .bashrc!

    Quote Originally Posted by ~LoKe View Post
    Code:
    alias back='cd $OLDPWD'
    alias root='sudo su'
    you can also do:
    alias back='cd -'
    alias root='sudo -i'

  8. #28
    Join Date
    Jul 2007
    Location
    India
    Beans
    6
    Distro
    Hardy Heron (Ubuntu Development)

    Re: Show us your .bashrc!

    This sounds amazing!!!!

    Going to try and edit it myself..........but does it cause any major damage if I screw it up???

  9. #29
    Join Date
    May 2007
    Location
    Philadelphia
    Beans
    Hidden!
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Show us your .bashrc!

    Just backup your current bashrc before starting and you'll be fine.

    ayoli, how'd you get the line like that? Firefox can't seem to figure out what the characters are.
    Last edited by Yes; March 3rd, 2008 at 09:36 PM.

  10. #30
    Join Date
    Jun 2006
    Location
    Millau, France
    Beans
    1,492
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Show us your .bashrc!

    Quote Originally Posted by Yes View Post
    Just backup your current bashrc before starting and you'll be fine.

    ayoli, how'd you get the line like that? Firefox can't seem to figure out what the characters are.
    browsers can't read these ascii chars but if you just download the bashrc.txt file linked in my previous post it will work.

Page 3 of 18 FirstFirst 1234513 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •