Page 2 of 18 FirstFirst 123412 ... LastLast
Results 11 to 20 of 173

Thread: Show us your .bashrc!

  1. #11
    Join Date
    Feb 2007
    Location
    Portugal
    Beans
    Hidden!
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Show us your .bashrc!

    uuuuu great thread idea Urukrama!
    mine is oh so simple...
    just one line... i need to setup some aliases they really help.
    Code:
    PS1='[\u\W] \[\e[0;30m\]//\[\e[1;37m\] '
    pekWM | archlinux | Dell E5400
    CounterStream Radio


  2. #12
    Join Date
    Feb 2007
    Location
    Edinburgh, Scotland
    Beans
    391

    Re: Show us your .bashrc!

    Thanks urukrama! Great thread and extract() from your .bashrc is very useful.

    Heres mine:

    Code:
    # ~/.bashrc: executed by bash(1) for non-login shells.
    # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
    # for examples
    
    # If not running interactively, don't do anything
    [ -z "$PS1" ] && return
    
    # don't put duplicate lines in the history. See bash(1) for more options
    export HISTCONTROL=ignoredups
    # ... and ignore same sucessive entries.
    export HISTCONTROL=ignoreboth
    
    # check the window size after each command and, if necessary,
    # update the values of LINES and COLUMNS.
    shopt -s checkwinsize
    
    # make less more friendly for non-text input files, see lesspipe(1)
    [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
    
    # set variable identifying the chroot you work in (used in the prompt below)
    if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
        debian_chroot=$(cat /etc/debian_chroot)
    fi
    
    # set a fancy prompt (non-color, unless we know we "want" color)
    case "$TERM" in
    xterm-color)
        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
        ;;
    *)
        PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
        ;;
    esac
    
    # Comment in the above and uncomment this below for a color prompt
    #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    
    # If this is an xterm set the title to user@host:dir
    case "$TERM" in
    xterm*|rxvt*)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
        ;;
    *)
        ;;
    esac
    
    # Alias definitions.
    # You may want to put all your additions into a separate file like
    # ~/.bash_aliases, instead of adding them here directly.
    # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    
    #if [ -f ~/.bash_aliases ]; then
    #    . ~/.bash_aliases
    #fi
    
    # enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
        eval "`dircolors -b`"
        alias ls='ls --color=auto'
        #alias dir='ls --color=auto --format=vertical'
        #alias vdir='ls --color=auto --format=long'
    fi
    
    # some more ls aliases
    #alias ll='ls -l'
    #alias la='ls -A'
    #alias l='ls -CF'
    
    # enable programmable completion features (you don't need to enable
    # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
    # sources /etc/bash.bashrc).
    if [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
    fi
    
    #Extract things. Thanks to urukrama, Ubuntuforums.org	
    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
    }
    
    alias mnt-mp3="sudo mount penguin:/media/Media ~/Media"
    alias mnt-www="sudo mount penguin:/var/www ~/www"
    alias mnt-docs="sudo mount penguin:/home/bobbo ~/Documents"
    alias mnt="mnt-docs; mnt-www; mnt-mp3"
    alias dopewars="dopewars -bt"
    alias kff="killall firefox-bin" #Because killall firefox-bin is far too long to type the amount i type it
    alias mpd="sudo mpd && sudo mpdscribble&"
    Basically default Ubuntu but with my nfs mounting, firefox killing and mpd initialising aliases. Oh and extract().
    Today we have 15 minutes of fame, tomorrow 15 minutes of anonymity.
    My Blog | Veza - Opensource TinyURL clone with sensible URLs

  3. #13
    Join Date
    May 2006
    Location
    NL
    Beans
    31
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Show us your .bashrc!

    Quote Originally Posted by andrek View Post


    /home/user/.bashrc - http://rafb.net/p/gKjiGI85.txt
    /root/.bashrc - http://rafb.net/p/FAl1VB26.txt (in case you're using 'su' instead of 'sudo')
    they arent there, can you re-upload them?

  4. #14
    Join Date
    Aug 2005
    Beans
    462

    Re: Show us your .bashrc!

    i went a bit crazy with mine.
    Code:
    [ -z "$PS1" ] && return
    
    # Bash completion
    if [ -f /etc/bash_completion ]; then
    	. /etc/bash_completion
    fi
    
    # Define a few Colours
    BLACK='\e[0;30m'
    BLUE='\e[0;34m'
    GREEN='\e[0;32m'
    CYAN='\e[0;36m'
    RED='\e[0;31m'
    PURPLE='\e[0;35m'
    BROWN='\e[0;33m'
    LIGHTGRAY='\e[0;37m'
    DARKGRAY='\e[1;30m'
    LIGHTBLUE='\e[1;34m'
    LIGHTGREEN='\e[1;32m'
    LIGHTCYAN='\e[1;36m'
    LIGHTRED='\e[1;31m'
    LIGHTPURPLE='\e[1;35m'
    YELLOW='\e[1;33m'
    WHITE='\e[1;37m'
    NC='\e[0m'              # No Color
    
    # check the window size after each command and, if necessary,
    # update the values of LINES and COLUMNS.
    shopt -s checkwinsize
    
    # make less more friendly for non-text input files, see lesspipe(1)
    [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
    
    ###############
    ### aliases ###
    ###############
    
    # General
    alias df='df -h'
    alias h='history'
    alias d='cd /home/iceni60/Desktop'
    alias duck='du -skc * | sort -rn'
    alias open='gnome-open'
    alias chm='kchmviewer'
    alias nb='nano ~/.bashrc'
    
    # screenshots
    alias screenshot='import -window root ~/Desktop/`date +%Y%m%d%H%M`.png'
    
    # System info
    alias cpuu="ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'"
    alias memu='ps -e -o rss=,args= | sort -b -k1,1n | pr -TW$COLUMNS'
    alias pg='ps aux | grep'  #requires an argument
    
    # weather
    alias weather='/home/iceni60/scripts/conky_scripts/weather.sh UKXX0085'
    
    # Music
    alias ncmpc='ncmpc -cm'
    
    # apt
    #alias search='apt-cache search'
    #alias agi='sudo apt-get install'
    #alias agr='sudo apt-get remove'
    #alias agu='sudo apt-get update'
    #alias agg='sudo apt-get upgrade'
    #alias sources='gksudo gedit /etc/apt/sources.list'
    
    # interactive
    alias cp='cp -vi'
    alias mv='mv -vi'
    alias rm='mv --target-directory=$HOME/.Trash/'
    
    # Directory navigation aliases
    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../..'
    alias .....='cd ../../../..'
    
    # display facts of the day
    alias today='grep -h -d skip `date +%m/%d` /home/iceni60/Ubuntu/usr/share/calendar/*'
    
    # network
    alias net1='watch --interval=2 "sudo netstat -apn -l -A inet"'
    alias net2='watch --interval=2 "sudo netstat -anp --inet --inet6"'  
    alias net3='sudo lsof -i'
    alias net4='watch --interval=2 "sudo netstat -p -e --inet --numeric-hosts"'
    alias net5='watch --interval=2 "sudo netstat -tulpan"'
    alias net6='sudo netstat -tulpan'
    alias net7='watch --interval=2 "sudo netstat -utapen"'
    alias net8='watch --interval=2 "sudo netstat -ano -l -A inet"'
    alias netl='sudo nmap -sT -O localhost' # more here http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/security-guide/s1-server-ports.html
    alias ping='ping -c 10'
    alias currports='wine /home/iceni60/Desktop/Desktop_Folder/Network_Tools/currports/cports.exe'
    alias winwhois='wine /home/iceni60/Desktop/Desktop_Folder/Network_Tools/win32whois_0_9_13/win32whois.exe'
    alias xnews='wine /home/iceni60/Desktop/Desktop_Folder/Network_Tools/XNews/XNEWS.EXE'
    alias whois='whois -H'
    
    # listings
    alias ls='ls --color=auto'
    alias lh='ls -lah'                # human readable (sizes) long and all ;-)
    alias lls='ls -l -h -g -F --color=auto'
    alias lc='ls -aCF'
    alias lsam='ls -am'               # List files horizontally
    alias lr='ls -lR'                 # recursive
    alias lsx='ls -ax'                # sort right to left rather then in columns
    alias lss='ls -shAxSr'            # sort by size
    alias lt='ls -lAtrh'              # sort by date and human readable
    alias lm='ls -al |more'           # pipe through 'more'
    
    # scripts
    alias calc='sh /home/iceni60/scripts/calc.sh'
    alias whatsmyip='/home/iceni60/scripts/whatsmyip.sh'
    alias unpack='/home/iceni60/scripts/unpack2dir.sh'
    
    # chmod and permissions commands
    alias mx='chmod a+x'
    alias 000='chmod 000'
    alias 644='chmod 644'
    alias 755='chmod 755'
    alias perm='stat --printf "%a %n \n "' # requires a file name e.g. perm file
    
    # lynx web browser
    alias bbc='lynx http://news.bbc.co.uk/text_only.stm'
    alias nytimes='lynx http://nytimes.com'
    alias dmregister='lynx http://desmoinesregister.com'
    alias google='lynx http://google.co.uk'
    
    # these, below, are without colour
    #alias bbc='lynx -term=vt100 http://news.bbc.co.uk/text_only.stm'
    #alias nytimes='lynx -term=vt100 http://nytimes.com'
    #alias dmregister='lynx -term=vt100 http://desmoinesregister.com'
    #alias google='lynx -term=vt100 http://google.co.uk'
    
    # WELCOME SCREEN
    #######################################################
    
    clear
    
    echo -ne "${LIGHTGREEN}" "Hello, $USER. today is, "; date
    echo -e "${WHITE}"; cal ;  
    echo -ne "${CYAN}";
    echo -ne "${LIGHTPURPLE}Sysinfo:";uptime ;echo ""
    
    
    # NOTES
    #######################################################
    
    # To temporarily bypass an alias, we preceed the command with a \  
    # EG:  the ls command is aliased, but to use the normal ls command you would 
    # type \ls 
    
    #################
    ### FUNCTIONS ###
    #################
    
    function    ff               { find . -name $@ -print; }
    
    function    rmd              { rm -fr $@; }
    
    function    osr              { shutdown -r now; }
    function    osh              { shutdown -h now; }
    
    function    mfloppy          { mount /dev/fd0 /mnt/floppy; }
    function    umfloppy         { umount /mnt/floppy; }
    
    function    mdvd             { mount -t iso9660 -o ro /dev/dvd /mnt/dvd; }
    function    umdvd            { umount /mnt/dvd; }
    
    function    mcdrom           { mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom; }
    function    umcdrom          { umount /mnt/cdrom; }
    
    function    psa              { ps aux $@; }
    function    psu              { ps  ux $@; }
    
    function    dub              { du -sclb $@; }
    function    duk              { du -sclk $@; }
    function    dum              { du -sclm $@; }
    
    function    dfk              { df -PTak $@; }
    function    dfm              { df -PTam $@; }
    function    dfh              { df -PTah $@; }
    function    dfi              { df -PTai $@; }
    
    # SPECIAL FUNCTIONS
    #######################################################
    
    # clock - A bash clock that can run in your terminal window. 
    clock () 
    { 
    while true;do clear;echo "===========";date +"%r";echo "===========";sleep 1;done 
    }
    
    netinfo ()
    {
    echo "--------------- Network Information ---------------"
    /sbin/ifconfig | awk /'inet addr/ {print $2}'
    echo ""
    /sbin/ifconfig | awk /'Bcast/ {print $3}'
    echo ""
    /sbin/ifconfig | awk /'inet addr/ {print $4}'
    
    # /sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
    echo "---------------------------------------------------"
    }
    
    # Define a word - USAGE: define dog
    define ()
    {
    lynx -dump "http://www.google.com/search?hl=en&q=define%3A+${1}&btnG=Google+Search" | grep -m 3 -w "*"  | sed 's/;/ -/g' | cut -d- -f1 > /tmp/templookup.txt
    			if [[ -s  /tmp/templookup.txt ]] ;then	
    				until ! read response
    					do
    					echo "${response}"
    					done < /tmp/templookup.txt
    				else
    					echo "Sorry $USER, I can't find the term \"${1} \""				
    			fi	
    \rm -f /tmp/templookup.txt
    }
    
    #####################################
    # ##### ENVIRONMENT VARIABLES ##### #
    #####################################
    
    declare -x HISTFILE=~/.bash_history
    declare -x HISTCONTROL=ignoredups
    declare -x HISTFILESIZE=100000
    declare -x HISTSIZE=100000
    
    
    
    
    ############################## ##################################
    # ##### PROMPT SECTION ##### ####################################
    ############################## ##################################
    
    ##PS1="\[\]\u:\w > \[\]"
    ##PS1="\[\][\[\]\u\[\]]\[\]\w > \[\]"
    #PS1="\[\][\[\]\u\[\]]\[\]\w > \[\]"
    #PS1="\[\][\[\]\[\]\u\[\]\[\]]\[\]\w > \[\]"
    ##PS1="\[\][\[\]\u\[\]]\[\]\w > \[\]"
    #PS1="\[\]\u \[\]\$\[\] \w \[\]"
    
    ###################### the above is a separate prompt which can be used instead of below. NOTE: only ONE line at a time should be uncommented. so there are 6 different prompts above!!!!!
    
    # color_name='\[\033[ color_code m\]'
    
    rgb_restore='\[\033[00m\]'
    rgb_black='\[\033[00;30m\]'
    rgb_firebrick='\[\033[00;31m\]'
    rgb_red='\[\033[01;31m\]'
    rgb_forest='\[\033[00;32m\]'
    rgb_green='\[\033[01;32m\]'
    rgb_brown='\[\033[00;33m\]'
    rgb_yellow='\[\033[01;33m\]'
    rgb_navy='\[\033[00;34m\]'
    rgb_blue='\[\033[01;34m\]'
    rgb_purple='\[\033[00;35m\]'
    rgb_magenta='\[\033[01;35m\]'
    rgb_cadet='\[\033[00;36m\]'
    rgb_cyan='\[\033[01;36m\]'
    rgb_gray='\[\033[00;37m\]'
    rgb_white='\[\033[01;37m\]'
    
    rgb_std="${rgb_white}"
    
    if [ `id -u` -eq 0 ]
    then
        rgb_usr="${rgb_red}"
    else
        rgb_usr="${rgb_green}"
    fi
    
    [ -n "$PS1" ] && PS1="${rgb_usr}`whoami`${rgb_std} \W ${rgb_usr}\\\$${rgb_restore} "
    
    unset   rgb_restore   \
            rgb_black     \
            rgb_firebrick \
            rgb_red       \
            rgb_forest    \
            rgb_green     \
            rgb_brown     \
            rgb_yellow    \
            rgb_navy      \
            rgb_blue      \
            rgb_purple    \
            rgb_magenta   \
            rgb_cadet     \
            rgb_cyan      \
            rgb_gray      \
            rgb_white     \
            rgb_std       \
            rgb_usr
    here's a screenshot with a couple of the things -

    Thanks to the forums staff for your dedication and hard work
    (the admins changed my sig to that lol )

  5. #15
    Join Date
    May 2006
    Location
    NL
    Beans
    31
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Show us your .bashrc!

    Can you post the details for that login message you have?

  6. #16
    Join Date
    Jul 2006
    Beans
    1,152

    Re: Show us your .bashrc!

    supertux, it is all in his/her bashrc file.

  7. #17
    Join Date
    Aug 2005
    Beans
    462

    Re: Show us your .bashrc!

    Quote Originally Posted by supertux View Post
    Can you post the details for that login message you have?
    do this -
    gedit ~/.bashrc

    and add this at the bottom, then open a new terminal -
    # WELCOME SCREEN
    ################################################## #####

    clear

    echo -ne "${LIGHTGREEN}" "Hello, $USER. today is, "; date
    echo -e "${WHITE}"; cal ;
    echo -ne "${CYAN}";
    echo -ne "${LIGHTPURPLE}Sysinfo:";uptime ;echo ""
    Thanks to the forums staff for your dedication and hard work
    (the admins changed my sig to that lol )

  8. #18
    Join Date
    May 2006
    Location
    NL
    Beans
    31
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Show us your .bashrc!

    Quote Originally Posted by ice60 View Post
    do this -
    gedit ~/.bashrc

    and add this at the bottom, then open a new terminal -
    # WELCOME SCREEN
    ################################################## #####

    clear

    echo -ne "${LIGHTGREEN}" "Hello, $USER. today is, "; date
    echo -e "${WHITE}"; cal ;
    echo -ne "${CYAN}";
    echo -ne "${LIGHTPURPLE}Sysinfo:";uptime ;echo ""
    very nice! thx!

  9. #19
    Join Date
    Aug 2005
    Beans
    462

    Re: Show us your .bashrc!

    Quote Originally Posted by supertux View Post
    very nice! thx!
    sorry, i forgot. add this anywhere above that last bit you put in. just delete what you added and start again and add this instead -

    # Define a few Colours
    BLACK='\e[0;30m'
    BLUE='\e[0;34m'
    GREEN='\e[0;32m'
    CYAN='\e[0;36m'
    RED='\e[0;31m'
    PURPLE='\e[0;35m'
    BROWN='\e[0;33m'
    LIGHTGRAY='\e[0;37m'
    DARKGRAY='\e[1;30m'
    LIGHTBLUE='\e[1;34m'
    LIGHTGREEN='\e[1;32m'
    LIGHTCYAN='\e[1;36m'
    LIGHTRED='\e[1;31m'
    LIGHTPURPLE='\e[1;35m'
    YELLOW='\e[1;33m'
    WHITE='\e[1;37m'
    NC='\e[0m' # No Color

    # WELCOME SCREEN
    ################################################## #####

    clear

    echo -ne "${LIGHTGREEN}" "Hello, $USER. today is, "; date
    echo -e "${WHITE}"; cal ;
    echo -ne "${CYAN}";
    echo -ne "${LIGHTPURPLE}Sysinfo:";uptime ;echo ""
    Thanks to the forums staff for your dedication and hard work
    (the admins changed my sig to that lol )

  10. #20
    Join Date
    Apr 2007
    Location
    Derby, UK
    Beans
    228

    Re: Show us your .bashrc!

    I haven't changed my .bashrc but...

    Code:
    dan@dan-laptop:~$ cat .bash_aliases 
    #aliases
    alias aliases='(gedit ~/.bash_aliases &)'
    
    #urxvt
    alias urxvt='urxvt -depth 32 -bg rgba:0000/0000/0000/dddd +sb -fn "fixed:pixelsize=9" &'
    
    #remote desktop
    alias school='(rdesktop [school IP] &)'
    
    #cd
    alias m='cd ~/Music'
    alias p='cd ~/Pictures'
    alias h='cd ~/Homework'
    alias d='cd ~/Desktop'
    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../..'
    alias .....='cd ../../../..'
    
    #ls
    alias ll='ls -l'
    alias la='ls -A'
    alias l='ls -CF'
    alias ldir='ls -p | grep \/'
    
    #delete
    alias del='mv --target-directory=/home/dan/.Trash/'
    
    #apt
    alias install='sudo apt-get install'
    alias remove='sudo apt-get remove'
    alias purge='sudo apt-get remove --purge'
    alias update='sudo apt-get update && sudo apt-get upgrade'
    alias upgrade='sudo apt-get upgrade'
    alias clean='sudo apt-get autoclean && sudo apt-get autoremove'
    alias search='apt-cache search'
    alias show='apt-cache show'
    alias sources='(gksudo gedit /etc/apt/sources.list &)'
    
    #ln
    alias ln='ln -s'
    
    #df
    alias dfh='df -h'
    
    #wc
    alias count='wc -l'
    
    #tar
    alias tarz='tar -xvzf'
    alias tarb='tar -xvjf'
    
    #xorg
    alias xorg='(gksudo gedit /etc/X11/xorg.conf &)'
    
    #compiz
    alias c='(compiz --replace &)'
    
    #conky
    alias conkyreset='killall -SIGUSR1 conky'
    alias conkyrc='(gedit ~/.conkyrc ~/.conkyrc2 ~/.conkyrc3 &)'
    alias conkyall='/home/dan/.conkyall'
    
    #on this day
    alias today='grep -h -d skip `date +%m/%d` /usr/share/calendar/*'
    
    #folding@home
    alias fahstart='sudo /etc/init.d/foldingathome start'
    alias fahstop='sudo /etc/init.d/foldingathome stop'
    alias fahrestart='sudo /etc/init.d/foldingathome restart'
    alias fahsend='sudo /etc/init.d/foldingathome send'
    alias fahstatus='sudo /etc/init.d/foldingathome status'
    alias fah='ps -ef | grep -i fah'
    
    #fluxbox
    alias fluxmenu='gedit ~/.fluxbox/menu &'
    alias fluxkeys='gedit ~/.fluxbox/keys &'
    alias fluxstart='gedit ~/.fluxbox/startup &'
    alias fluxstyle='gedit ~/.fluxbox/styles/Modified\ Nyz &'
    Last.fm | Linux User#449102 | Ubuntu User#15213
    NEVER type a command you don't understand eg. sudo rm -rf / or something similar
    Learn about them here or here.

Page 2 of 18 FirstFirst 123412 ... 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
  •