SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-02-03 11:52:27

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Post your .bashrc!

PS1='\[\033[1;31m\]\W/\[\033[0m\] '

##### DEFAULTS #####

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

PROMPT_COLOR='35;1m'

export HISTCONTROL=ignoreboth
export EDITOR="nano"
export VISUAL="nano"

shopt -s histappend
shopt -s checkwinsize

# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh 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

# Color prompt
force_color_prompt=yes

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# 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



##### CUSTOM STARTS HERE #####

### FUNCTIONS

# Easy extract
extract () {
  if [ -f $1 ] ; then
      case $1 in
          *.tar.bz2)   tar xvjf $1    ;;
          *.tar.gz)    tar xvzf $1    ;;
          *.bz2)       bunzip2 $1     ;;
          *.rar)       rar x $1       ;;
          *.gz)        gunzip $1      ;;
          *.tar)       tar xvf $1     ;;
          *.tbz2)      tar xvjf $1    ;;
          *.tgz)       tar xvzf $1    ;;
          *.zip)       unzip $1       ;;
          *.Z)         uncompress $1  ;;
          *.7z)        7z x $1        ;;
          *)           echo "don't know how to extract '$1'..." ;;
      esac
  else
      echo "'$1' is not a valid file!"
  fi
}

# Makes directory then moves into it
function mkcdr {
    mkdir -p -v $1
    cd $1
}

# Creates an archive from given directory
mktar() { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
mktgz() { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }

### ALIASES

## Keeping things organized
alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -A'
alias rm='mv -t ~/.local/share/Trash/files'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p -v'
alias df='df -h'
alias du='du -h -c'
alias reload='source ~/.bashrc'
alias biggest='BLOCKSIZE=1048576; du -x | sort -nr | head -10'

## Moving around & all that jazz
alias back='cd $OLDPWD'
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."

## Dir shortcuts
alias home='cd ~/'
alias documents='cd ~/Documents'
alias downloads='cd ~/Downloads'
alias books='cd ~/eBooks'
alias images='cd ~/Images'
alias packages='cd ~/Packages'
alias aruby='cd ~/Ruby'
alias torrents='cd ~/Torrents'
alias videos='cd ~/Videos'
alias webdesign='cd ~/Web\ Design'
alias localhost='cd /var/www'

## App-specific
alias nano='nano -W -m'
alias music='ncmpcpp'
alias ftp='ncftp Personal'
alias wget='wget -c'
alias scrot='scrot -c -d 7'

## Easy script callin'
alias show-info='~/.bin/info.pl'
alias show-colors='~/.bin/colors.sh'

## Sudo fixes
alias install='sudo apt-get install'
alias remove='sudo apt-get remove'
alias orphand='sudo deborphan | xargs sudo apt-get -y remove --purge'
alias cleanup='sudo apt-get autoclean && sudo apt-get autoremove && sudo apt-get clean && sudo apt-get remove && orphand'
alias updatedb='sudo updatedb'

## Dev related
alias restart-apache='sudo /etc/init.d/apache2 restart'

## Misc
alias edit='nano'

Last edited by dannytatom (2009-02-03 19:58:48)

Offline

Be excellent to each other!

#2 2009-02-03 13:42:02

kestrel
Species: F. sparverius
From: Moscow, Idaho
Registered: 2008-11-29
Posts: 170
Website

Re: Post your .bashrc!

I like to keep all my aliases in a separate file for mobility. I then add this line to my .bashrc

. /home/will/.aliases

Contents of /home/will/.aliases before swiping some of yours:D

# some more ls aliases
alias ls='ls -hF --color'    # add colors for filetype recognition
alias lx='ls -lXB'        # sort by extension
alias lk='ls -lSr'        # sort by size
alias la='ls -Al'        # show hidden files
alias lr='ls -lR'        # recursice ls
alias lt='ls -ltr'        # sort by date
alias lm='ls -al |more'        # pipe through 'more'
alias tree='tree -Cs'        # nice alternative to 'ls'
alias ll='ls -l'        # long listing
alias l='ls -hF --color'    # quick listing
alias lsize='ls --sort=size -lhr' # list by size
alias l?='cat /home/will/technical/tips/ls'
alias lsd='ls -l | grep "^d"'   #list only directories

Command substiution
alias ff='sudo find / -name $1'
alias df='df -h -x tmpfs -x usbfs'
alias psg='ps -ef | grep $1'
alias h='history | grep $1'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias which='type -all'
alias ..='cd ..'
alias path='echo -e ${PATH//:/\\n}'
alias vi='vim'
alias du='du -h --max-depth=1'

#Personal Help
alias a?='cat /home/will/.alias.help'
alias f?='cat /home/will/.function.help'
alias dn='OPTIONS=$(\ls -F | grep /$); select s in $OPTIONS; do cd $PWD/$s; break;done'
alias help='OPTIONS=$(\ls ~/.tips -F);select s in $OPTIONS; do less ~/.tips/$s; break;done' 

#Truecrypt
alias mtrue='sudo truecrypt /media/usbdisk/kestrel.tc ~/kestrel'
alias utrue='sudo truecrypt -d'

#Rsync
#alias usbb='rsync -avz /media/usbdisk/ ~/backup/usb/'

#Timestamps
alias stamp='date "+%Y%m%d%a%H%M"'
alias da='date "+%Y-%m-%d %A    %T %Z"'

#show most popular commands
alias top-commands='history | awk "{print $2}" | awk "BEGIN {FS="|"} {print $1}" |sort|uniq -c | sort -rn | head -10'

# search for a package
alias search="apt-cache search"

# empty trash
alias trash="rm -fr ~/.Trash"

Offline

#3 2009-02-03 14:59:14

pakman
Member
From: Dundee, Scotland
Registered: 2009-01-12
Posts: 41

Re: Post your .bashrc!

I've never used aliases before, but after seeing what you guys have done with them, I can't wait to get home from work and give it a go!

@ Kestrel: I really like the idea of a separate file. Where abouts in the .bashrc would you add the additional line? Or is it possible to just add it anywhere?


Bob

Offline

#4 2009-02-03 21:44:30

rantak
New Member
Registered: 2009-01-25
Posts: 1

Re: Post your .bashrc!

Using separate alias file: (put this in .bashrc)

# 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

This would use .bash_aliases in the home directory

Last edited by rantak (2009-02-03 21:53:34)

Offline

#5 2009-02-04 03:17:42

kestrel
Species: F. sparverius
From: Moscow, Idaho
Registered: 2008-11-29
Posts: 170
Website

Re: Post your .bashrc!

# ~/.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

# Set some colors
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

# don't put duplicate lines in the history. See bash(1) for more options
export EDITOR=/usr/bin/vim    # the one and only editor
export HISTFILESIZE=300000    # save 300000 commands
export HISTCONTROL=ignoredups    # no duplicate lines in the history.
export HISTSIZE=100000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
shopt -s histappend
export PROMPT_COMMAND='history -a'


# 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


. /home/will/.aliases
. /home/will/.functions

# export PATH=/opt/openoffice.org3/program:/home/will/bin:$PATH

# 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
if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# A color and a non-color prompt:    
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w \$ '

# 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}\007"'
    ;;
*)
    ;;
esac

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc).
#if [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#fi


# This line was appended by KDE
# Make sure our customised gtkrc file is loaded.
export GTK2_RC_FILES=$HOME/.gtkrc-2.0

#------------------------------------------
#------WELCOME MESSAGE---------------------
# customize this first message with a message of your choice.
# this will display the username, date, time, a calendar, the amount of users, and the up time.
clear
# Gotta love ASCII art with figlet
figlet "Welcome, " $USER;
echo -e ""
echo -ne "Today is "; date
echo -e ""; cal ;
echo -ne "Up time:";uptime | awk /'up/'
echo "";

#------------------------------------------
#------ENCRYPTION/DECRYPTION--------------
# requires gpg
# the proper way to use these functions is simply to enter "encrypt filename" or "decrypt filename"
encrypt ()
{
gpg -ac --no-options "$1"
}

decrypt ()
{
gpg --no-options "$1"
}
#------------------------------------------
#------Extraction of compressed files--------------
# from ARCH Wiki

extract () {
  if [ -f $1 ] ; then
      case $1 in
          *.tar.bz2)   tar xvjf $1    ;;
          *.tar.gz)    tar xvzf $1    ;;
          *.bz2)       bunzip2 $1     ;;
          *.rar)       rar x $1       ;;
          *.gz)        gunzip $1      ;;
          *.tar)       tar xvf $1     ;;
          *.tbz2)      tar xvjf $1    ;;
          *.tgz)       tar xvzf $1    ;;
          *.zip)       unzip $1       ;;
          *.Z)         uncompress $1  ;;
          *.7z)        7z x $1        ;;
          *)           echo "don't know how to extract '$1'..." ;;
      esac
  else
      echo "'$1' is not a valid file!"
  fi
}

Offline

#6 2009-02-04 04:59:23

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Post your .bashrc!

Tiny point - you don't need:
alias home='cd ~/'
just

cd

should take you to ~/ anyway.

Offline

#7 2009-02-04 06:37:07

moriancumer_12
Member
Registered: 2008-11-24
Posts: 13

Re: Post your .bashrc!

Nothing too fancy.

# ~/.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

# 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

# Created by James Manning <jmm@raleigh.ibm.com>
# Changed by Spidey 08/06
function combo {
PS1="\[\033[01;34;01m\]\333\262\261\260\[\033[01;37;44m\]\u@\h\[\033[00;34;40m\]\260\261\262\333\[\033[00;34;40m\]\333\262\261\260\[\033[01;37;40m\]\d \$(date +%I:%M:%S%P)\n\[\033[01;33;40m\]$PWD>\[\033[00m\] "
PS2="\[\033[01;34;01m\]\333\262\261\260\[\033[00;34;40m\]\260\261\262\333\[\033[00;34;40m\]\333\262\261\260\[\033[01;01;34m\]>\[\033[00m\] 
"
}

# 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'
alias weather='/usr/bin/weather -f --id=KSLC'
alias gcalcli='gcalcli --cals all'

# 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

function my_ip() # get IP adresses
{
        MY_IP=$(/sbin/ifconfig eth0 | awk "/inet/ { print $2 } " | sed -e s/addr://)
        MY_ISP=$(/sbin/ifconfig eth0 | awk "/P-t-P/ { print $3 } " | sed -e s/P-t-P://)
}

function ii() # get current host related info
{
    echo -e "\nYou are logged on ${RED}$HOST"
    echo -e "\nAdditionnal information:$NC " ; uname -a
    echo -e "\n${RED}Users logged on:$NC " ; w -h
    echo -e "\n${RED}Current date :$NC " ; date
    echo -e "\n${RED}Machine stats :$NC " ; uptime
    echo -e "\n${RED}Memory stats :$NC " ; free
    my_ip 2>&. ;
    echo -e "\n${RED}Local IP Address :$NC" ; echo ${MY_IP:."Not connected"}
    echo -e "\n${RED}ISP Address :$NC" ; echo ${MY_ISP:."Not connected"}
    echo
}

PATH="$HOME/bin:$PATH"

/usr/bin/verse

export PATH=/usr/local/arm/bin:$PATH

Offline

#8 2009-02-04 10:13:45

pakman
Member
From: Dundee, Scotland
Registered: 2009-01-12
Posts: 41

Re: Post your .bashrc!


Bob

Offline

#9 2009-02-05 06:54:33

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

cd

Last edited by dannytatom (2009-02-05 06:55:17)

Offline

#10 2009-02-05 13:24:11

kestrel
Species: F. sparverius
From: Moscow, Idaho
Registered: 2008-11-29
Posts: 170
Website

Re: Post your .bashrc!

Thanks for sharing Danny. One thing I find harder and harder is remembering all the cool little functions, scripts and aliases I've created and collected over the years. I need a function that remembers all my functions??

Offline

#11 2009-02-05 18:03:07

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

Haha, I'm lookin' into a way to submit form data from bash.  Then you could submit your .bashrc/.aliases to dotfiles every so often. wink

No clue if thats possible, though. sad

Offline

#12 2009-02-05 20:03:23

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,486

Re: Post your .bashrc!

I don't know if you can submit form data with bash danny, but I know you can do it in python with mechanize.


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

#13 2009-02-05 21:47:15

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

Hm, yeah, seems to be the case.  I'll have to look into it, I've never messed with Python. ;o

Offline

#14 2009-02-10 09:43:44

pitje
#! Junkie
From: me to you
Registered: 2009-02-10
Posts: 438
Website

Re: Post your .bashrc!

# conky:  configuration file
# author: pitje

# do not fork to background
background no

# font settings
use_xft yes
xftalpha 0.1
font AquaBase-8
uppercase no
override_utf8_locale yes

no_buffers no
text_buffer_size 512

# update every 1 sec
#update_interval 1

# stay running forever
total_run_times 0

# window
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# avoid flickering
double_buffer yes

# size
minimum_size 250 5
maximum_width 300

# position
alignment bottom_right
#alignment top_right
gap_x 10
gap_y 10

# colors
default_color white
default_shade_color1
default_outline_color1
color1 000000
color2 444444
color3 808080

# borders
draw_borders no
draw_graph_borders no
stippled_borders 8
border_margin 4
border_width 1

# shades
draw_shades no

# outline
draw_outline no

# spacer
use_spacer yes

cpu_avg_samples 2
net_avg_samples 1
short_units yes

TEXT
${voffset 1}
${font Bitstream Vera Sans roman:size=24}${alignc}${color3}${exec who | grep tty | awk '{print $1}'}${color2}@${color3}${nodename}
${voffset -15}${color2}${font Bitstream Vera Sans roman:bold:size=10}${color2}SYSTEM ${color1} ${hr 2}
${font}${color2}${sysname} ${kernel} ${alignr}${machine}
Uptime${alignr}${uptime}
Load${alignr}${loadavg}
${font Bitstream Vera Sans roman:bold:size=10}${color2}PROCESSOR ${color1}${hr 2}
${font}${color2}CPU1 ${cpu cpu1}%${alignr}CPU2 ${cpu cpu2}%
${cpubar cpu1 5,110 $color1 $color3}${alignr}${cpubar cpu2 5,110 $color1 $color3}
${cpugraph cpu1 15,110 $color1 $color3}${alignr}${cpugraph cpu2 15,110 $color1 $color3}
${alignr}PID     CPU%   MEM%
${top name 1}${alignr} ${top pid 1}    ${top cpu 1}    ${top mem 1}
${top name 2}${alignr} ${top pid 2}    ${top cpu 2}    ${top mem 2}
${top name 3}${alignr} ${top pid 3}    ${top cpu 3}    ${top mem 3}
${font Bitstream Vera Sans roman:bold:size=10}${color2}MEMORY ${color1}${hr 2}
${font}${color2}RAM${alignc}${mem} / ${memmax} ${alignr} ${memperc}%
${membar}
SWAP${alignc}${swap}/ ${swapmax}${alignr}${swapperc}%
${swapbar}
${alignr}PID     CPU%   MEM%
${top_mem name 1}${alignr} ${top_mem pid 1}    ${top_mem cpu 1}    ${top_mem mem 1}
${top_mem name 2}${alignr} ${top_mem pid 2}    ${top_mem cpu 2}    ${top_mem mem 2}
${top_mem name 3}${alignr} ${top_mem pid 3}    ${top_mem cpu 3}    ${top_mem mem 3}
${font Bitstream Vera Sans roman:bold:size=10}${color2}HDD ${color1}${hr 2}
${font}${color2}/${alignc}${fs_used /}/ ${fs_size /}${alignr}${fs_free_perc /}%
${fs_bar /}
${font}${color2}/home${alignc}${fs_used /home}/ ${fs_size /home}${alignr}${fs_free_perc /home}%
${fs_bar /home}
${font}${color2}/various${alignc}${fs_used /media/various}/ ${fs_size /media/various}${alignr}${fs_free_perc /media/various}%
${fs_bar /media/various}

${font Bitstream Vera Sans roman:bold:size=10}${color2}NETWORK ${color1}${hr 2}
${font}${color2}External IP: ${alignr}${execi 600 wget -O - http://pitje.ath.cx/ip.php | tail}
IP (eth0):${alignr}${addr eth0}
Down: ${downspeed eth0} k/s ${alignr}Up: ${upspeed eth0} k/s
${downspeedgraph eth0 20,90 $color1 $color3} ${alignr}${upspeedgraph eth0 20,90 $color1 $color3}
Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0}
${font Bitstream Vera Sans roman:bold:size=10}${color2}TIME ${color1}${hr 2}
${alignr}${voffset -5}${offset -55}${color2}${font :size=36}${time %H}${font :size=18}${voffset -15}${time %M}
${voffset -15}${font Bitstream Vera Sans roman:bold:size=8}${alignr}${time %a}
${font :size=12}${alignr}${time %Y.%m.%d}

oh yeah? well, your momma dresses you funny and you need a mouse to delete files

Offline

#15 2009-02-10 09:59:57

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

Offline

#16 2009-02-10 10:38:17

pitje
#! Junkie
From: me to you
Registered: 2009-02-10
Posts: 438
Website

Re: Post your .bashrc!

# ~/.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'

alias aptinstall='sudo apt-get install'
alias aptsearch='sudo apt-cache search'

# 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


#test if a file should be opened normally, or as root (vi)
argc () {
        count=0;
        for arg in "$@"; do
                if [[ ! "$arg" =~ '-' ]]; then count=$(($count+1)); fi;
        done;
        echo $count;
}

vi () { if [[ `argc "$@"` > 1 ]]; then /usr/bin/vim $@;
                elif [ $1 = '' ]; then /usr/bin/vim;
                elif [ ! -f $1 ] || [ -w $1 ]; then /usr/bin/vim $@;
                else
                        echo -n "File is readonly. Edit as root? (Y/n): "
                        read -n 1 yn; echo;
                        if [ "$yn" = 'n' ] || [ "$yn" = 'N' ];
                            then /usr/bin/vim $*;
                            else sudo /usr/bin/vim $*;
                        fi
                fi
            }

Last edited by pitje (2009-02-10 10:47:04)


oh yeah? well, your momma dresses you funny and you need a mouse to delete files

Offline

#17 2009-02-24 14:16:12

machiner
Member
Registered: 2009-02-23
Posts: 14

Re: Post your .bashrc!

#!/bin/bash
#------------------------------------------////
# Lapbox ~/.bashrc file
# Last Modified 20 January 2009
# Running on Debian GNU/Linux - Lenny
#------------------------------------------////
#------------------------------------------////
# Colors:
#------------------------------------------////
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'

#------------------------------------------////
# Proxy:
#------------------------------------------////
#http_proxy=http://127.0.0.1:8118/
#HTTP_PROXY=$http_proxy
#export http_proxy HTTP_PROXY

#------------------------------------------////
# Aliases:
#------------------------------------------////
## make ls list by size
##alias ls='du -s */* | sort -n'
alias findbig='find . -type f -exec ls -s {} \; | sort -n -r | head -5'
alias tunes='rhythmbox'
alias ports='netstat -nape --inet'
alias opennet='lsof -i'
alias dsite='opera -newpage [url]http://www.debiantutorials.org[/url] &'
alias dtadmin='opera -newpage [url]http://www.XXXXXXXXXXXX[/url] &'
alias forum=' opera -newpage [url]http://www.debiantutorials.org/talkitup/index.php[/url] &'
alias stats=' opera -newpage [url]http://www.XXXXXXXXXXXX[/url]'
alias steves='ssh -p XXXX hbserv1'
alias 150='ssh -l XXXXXX -p XXXX hbserv1'
alias madcarters='ssh -p XXXX hbserv1 -l XXXXXX'
alias pungent-judy='ssh -p XXXX hbserv1 -l XXXXXX'
alias linux-impressions='ssh -p XXXX hbserv1 -l XXXXXX'
alias debianathome='ssh -p XXXX hbserv1 -l XXXXXX'
alias geek-feed='ssh -p XXXX hbserv1 -l XXXXXX'
alias mcorgadmin='ssh -p XXXX hbserv1 -l XXXXXX'
alias ping='ping -c 4'
alias ns='netstat -alnp --protocol=inet'
alias search='aptitude search'
alias show='aptitude show'
alias ls='ls -aF --color=always'
alias la='ls -Al'
alias lx='ls -lXB'
alias lk='ls -lSr'
alias lc='ls -lcr'
alias lu='ls -lur'
alias lr='ls -lR'
alias lt='ls -ltr'
alias lm='ls -al |more'
#alias rm='rm -i'
#------------------------------------------////
# Functions and Scripts:
#------------------------------------------////
localnet ()
{
/sbin/ifconfig | awk /'inet addr/ {print $2}' 
echo ""
/sbin/ifconfig | awk /'Bcast/ {print $3}' 
echo ""
}
myip ()
{
lynx -dump -hiddenlinks=ignore -nolist [url]http://checkip.dyndns.org:8245/[/url] | grep "Current IP Address" | cut -d":" -f2 | cut -d" " -f2
}
upinfo ()
{
echo -ne "${green}$HOSTNAME ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
}
cd() 
{
  if [ -n "$1" ]; then
    builtin cd "$@" && ls
  else
    builtin cd ~ && ls
  fi
}
weather ()
{
declare -a WEATHERARRAY
WEATHERARRAY=( `lynx -dump "[url]http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla_en-US_official&q=weather+${1}&btnG=Search[/url]" | grep -A 5 -m 1 "Weather for" | sed 's;\[26\]Add to iGoogle\[27\]IMG;;g'`)
echo ${WEATHERARRAY[@]}
}

encrypt ()
{
gpg -ac --no-options "$1"
}

decrypt ()
{
gpg --no-options "$1"
}

extract()
{
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*) echo "'$1' cannot be extracted." ;;
esac
else
echo "'$1' is not a file."
fi
}
#------------------------------------------////
# Some original .bashrc contents:
#------------------------------------------////
# 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
# 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
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#------------------------------------------////
# Prompt:
#------------------------------------------////


PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]:\[\033[00m\]'

#------------------------------------------////
# System Information:
#------------------------------------------////
clear
echo -e "${LIGHTGRAY}";figlet "Terminal Fu";
echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${cyan}";upinfo;echo ""
echo -e "${cyan}"; cal -3

Offline

#18 2009-02-24 15:21:17

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

Colorful. big_smile  Mind putting all the code in code tags, helps with page length. wink

Offline

#19 2009-02-25 10:20:56

Visti
New Member
Registered: 2009-02-21
Posts: 4

Re: Post your .bashrc!

#!/bin/bash
#------------------------------------------////
# Lapbox ~/.bashrc file
# Last Modified 20 January 2009
# Running on Debian GNU/Linux - Lenny
#------------------------------------------////
#------------------------------------------////
# Colors:
#------------------------------------------////
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'

#------------------------------------------////
# Proxy:
#------------------------------------------////
#http_proxy=http://127.0.0.1:8118/
#HTTP_PROXY=$http_proxy
#export http_proxy HTTP_PROXY

#------------------------------------------////
# Aliases:
#------------------------------------------////
## make ls list by size
##alias ls='du -s */* | sort -n'
alias findbig='find . -type f -exec ls -s {} \; | sort -n -r | head -5'
alias music='mocp'
alias ports='netstat -nape --inet'
alias ping='ping -c 4'
alias ns='netstat -alnp --protocol=inet'
alias search='aptitude search'
alias show='aptitude show'
alias ls='ls --color=always'
alias la='ls -Al'
alias lx='ls -lXB'
alias lk='ls -lSr'
alias lc='ls -lcr'
alias lu='ls -lur'
alias lr='ls -lR'
alias lt='ls -ltr'
alias lm='ls -al |more'
alias lr='ls -R' # using ls recursively - Handy with grep
alias rlslog='elinks www.rlslog.net' # opens rlslog in terminal

# Changing ethernet settings through scripts
alias xbox='sudo sh ~/.config/openbox/xboxscript.sh'
alias stofa='sudo cp /etc/network/stofa /etc/network/interfaces'

#alias rm='rm -i'
#------------------------------------------////
# Functions and Scripts:
#------------------------------------------////
localnet ()
{
/sbin/ifconfig | awk /'inet addr/ {print $2}'
echo ""
/sbin/ifconfig | awk /'Bcast/ {print $3}'
echo ""
}
myip ()
{
elinks -dump http://checkip.dyndns.org:8245/ | grep "Current IP Address" | cut -d":" -f2 | cut -d" " -f2
}
upinfo ()
{
echo -ne "${green}$HOSTNAME ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
}
cd()
{
  if [ -n "$1" ]; then
    builtin cd "$@" && ls
  else
    builtin cd ~ && ls
  fi
}
weather ()
{
declare -a WEATHERARRAY
WEATHERARRAY=( `lynx -dump "http://www.google.com/search?hl=en& … tnG=Search" | grep -A 5 -m 1 "Weather for" | sed 's;\[26\]Add to iGoogle\[27\]IMG;;g'`)
echo ${WEATHERARRAY[@]}
}

encrypt ()
{
gpg -ac --no-options "$1"
}

decrypt ()
{
gpg --no-options "$1"
}

extract()
{
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*) echo "'$1' cannot be extracted." ;;
esac
else
echo "'$1' is not a file."
fi
}
#------------------------------------------////
# Some original .bashrc contents:
#------------------------------------------////
# 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
# 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
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#------------------------------------------////
# Prompt:
#------------------------------------------////

PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]:\[\033[00m\]'

#------------------------------------------////
# System Information:
#------------------------------------------////
clear
echo -e "${LIGHTGRAY}";figlet "Laptop Term";
echo ""
echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${cyan}";upinfo;echo ""
echo -e "${cyan}"; cal -3
echo ""

Offline

#20 2009-02-25 15:23:52

omns
#! wanderer
From: ~/
Registered: 2008-11-25
Posts: 5,131

Re: Post your .bashrc!

Offline

#21 2009-02-25 18:06:59

ggordon
#! Member
From: Benbrook, TX
Registered: 2008-11-26
Posts: 69

Re: Post your .bashrc!

That is one wild .bashrc script....very cool.


smile

ggordon

Offline

#22 2009-02-25 19:58:05

omns
#! wanderer
From: ~/
Registered: 2008-11-25
Posts: 5,131

Re: Post your .bashrc!

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

#------------------------------------------////
# Some original crunchbang .bashrc contents:
#------------------------------------------////

# 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
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

# 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 "$(SHELL=/bin/sh 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) color_prompt=yes;;
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 [ -x /usr/bin/dircolors ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# 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

#------------------------------------------////
# Aliases:
#------------------------------------------////

## Keeping things organized
alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias reload='source ~/.bashrc'
alias biggest='BLOCKSIZE=1048576; du -x | sort -nr | head -10'

## Dir shortcuts
alias home='cd ~/'
alias documents='cd ~/documents'
alias downloads='cd ~/downloads'
alias images='cd ~/images'
alias videos='cd ~/videos'


## Sudo fixes
alias install='sudo apt-get install'
alias remove='sudo apt-get remove'
alias update='sudo apt-get update'
alias upgrade='sudo apt-get update && sudo apt-get upgrade'
alias dupgrade='sudo apt-get update && sudo apt-get dist-upgrade'
alias orphand='sudo deborphan | xargs sudo apt-get -y remove --purge'
alias cleanup='sudo apt-get autoclean && sudo apt-get autoremove && sudo apt-get clean && sudo apt-get remove && orphand'
alias updatedb='sudo updatedb'


#------------------------------------------////
# Proxy:
#------------------------------------------////
#Setting Proxy Environment Variable  
#export http_proxy="http://username:password@my.proxy.address:8080/" 

#------------------------------------------////
# Colors:
#------------------------------------------////
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'

#------------------------------------------////
# Functions and Scripts:
#------------------------------------------////
upinfo ()
{
echo -ne "\t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
}

# Creates an archive from given directory
mktar() { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
mktgz() { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }

#------------------------------------------////
# Prompt:
#------------------------------------------////
PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\](\[\033[01;34m\]\w\[\033[00;34m\])\[\033[01;32m\]:\[\033[00m\]'

#------------------------------------------////
# System Information:
#------------------------------------------////
clear
echo -e "${LIGHTGRAY}";figlet "om  shanti";
echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${red}Uptime is: \t${cyan}";upinfo;echo ""
echo -e "${cyan}"; cal -3

Offline

#23 2009-02-27 17:37:03

machiner
Member
Registered: 2009-02-23
Posts: 14

Re: Post your .bashrc!

#!/bin/bash
#------------------------------------------////
# Lapbox ~/.bashrc file
# Last Modified 26 February 2009
# Running on Debian GNU/Linux - Lenny
#------------------------------------------////
#------------------------------------------////
# Colors:
#------------------------------------------////

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'

#------------------------------------------////
# Proxy:
#------------------------------------------////

#http_proxy=http://127.0.0.1:8118/
#HTTP_PROXY=$http_proxy
#export http_proxy HTTP_PROXY

#------------------------------------------////
# Aliases:
#------------------------------------------////

## make ls list by size
##alias ls='du -s */* | sort -n'
alias findbig='find . -type f -exec ls -s {} \; | sort -n -r | head -5'
alias tunes='rhythmbox'
alias ports='netstat -nape --inet'
alias debtoots='opera -newpage http://www.debiantutorials.org &'
alias dtadmin='opera -newpage XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
alias forum=' opera -newpage http://www.debiantutorials.org/talkitup/index.php &'
alias stats=' opera -newpage http://xxxxxxxxxxxxxxxxxxxxxxx'
alias steves='ssh -p XXXXXX XXXXXXXXXXXX'
alias 150='ssh -l founder -p XXXXXX XXXXXXXXXXXX'
alias madcarters='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias pungent-judy='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias linux-impressions='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias debianathome='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias geek-feed='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias mcorgadmin='ssh -p XXXXXX XXXXXXXXXXXX -l UNAME'
alias ping='ping -c 4'
alias ns='netstat -alnp --protocol=inet'
alias search='aptitude search'
alias show='aptitude show'
alias ls='ls -aF --color=always'
alias la='ls -Al'
alias lx='ls -lXB'
alias lk='ls -lSr'
alias lc='ls -lcr'
alias lu='ls -lur'
alias lr='ls -lR'
alias lt='ls -ltr'
alias lm='ls -al |more'
#alias rm='rm -i'

#------------------------------------------////
# Functions and Scripts:
#------------------------------------------////

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth

##WOOT!

localnet ()
{
/sbin/ifconfig | awk /'inet addr/ {print $2}' 
echo ""
/sbin/ifconfig | awk /'Bcast/ {print $3}' 
echo ""
}
myip ()
{
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | grep "Current IP Address" | cut -d":" -f2 | cut -d" " -f2
}
upinfo ()
{
echo -ne "${green}$HOSTNAME ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
}
cd() 
{
  if [ -n "$1" ]; then
    builtin cd "$@" && ls
  else
    builtin cd ~ && ls
  fi
}
weather ()
{
declare -a WEATHERARRAY
WEATHERARRAY=( `lynx -dump "http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla_en-US_official&q=weather+${1}&btnG=Search" | grep -A 5 -m 1 "Weather for" | sed 's;\[26\]Add to iGoogle\[27\]IMG;;g'`)
echo ${WEATHERARRAY[@]}
}

encrypt ()
{
gpg -ac --no-options "$1"
}

decrypt ()
{
gpg --no-options "$1"
}

extract()
{
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.tar.Z) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.jar) unzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*) echo "'$1' cannot be extracted." ;;
esac
else
echo "'$1' is not a file."
fi
}

#------------------------------------------////
# Some default .bashrc contents:
#------------------------------------------////

# 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
# 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
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

#------------------------------------------////
# Prompt:
#------------------------------------------////

PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]:\[\033[00m\]'

#------------------------------------------////
# System Information:
#------------------------------------------////

clear
echo -e "${LIGHTGRAY}";figlet "Terminal Fu";
echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${cyan}";upinfo;echo ""
echo -e "${cyan}"; cal -3

Last edited by machiner (2009-02-27 17:53:56)

Offline

#24 2009-02-27 18:03:48

machiner
Member
Registered: 2009-02-23
Posts: 14

Re: Post your .bashrc!

Offline

Help fund CrunchBang, donate to the project!

#25 2009-02-27 18:52:32

dannytatom
#! CrunchBanger
From: Ashdown, AR
Registered: 2009-01-10
Posts: 190

Re: Post your .bashrc!

Well, at first I didn't realize cd went straight to home dir.  Also though, a lot of my aliases aren't really to save typing, but to make it more 'english.'

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo