You are not logged in.

#1 2007-12-23 07:32:37

travkin
Member
Registered: 2007-12-21
Posts: 21

Share your bashrc!

subject.
wink

Offline

#2 2007-12-23 08:14:38

Jansson
Member
From: Sweden
Registered: 2006-09-10
Posts: 106

Re: Share your bashrc!

Mine, consisting only of aliases and a modified promt:

alias ls='ls --color=auto'
alias g++='g++ -Wall -pedantic'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias du='du -h'
alias urxvt='urxvt -bg black -fg white +sb'

PS1='\[\e[0;32m\](\w) \$ \[\e[0;37m\]'

Offline

#3 2007-12-23 09:50:29

Mantaar
Member
Registered: 2007-12-17
Posts: 70

Re: Share your bashrc!

Let's see...

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

... huh. I don't use bash! wink

So, here's my .zshrc instead:

# Set keymap. This goes along with a NOPASSWD entry in sudoers
if [ $TERM = "linux" ]; then
    sudo loadkeys ~/.capsesc_swap&>/dev/null
fi

set -o vi
PATH="${HOME}/bin:${PATH}"

### Environment
###############

export VISUAL=/usr/bin/vim
export EDITOR=/usr/bin/vim

export PAGER="most -s"
export BROWSER="most -s"

NNTPSERVER=news.belwue.de

MAILDIR="$HOME/.maildir"


### CLASSPATH 
if [ -d ~/dat/src/java ]; then
    CLASSPATH=~/dat/src/java
fi
# Custom Progs
if [ -d ~/opt/java ]; then
    for i in ~/opt/java/*; do
        CLASSPATH="$i:${CLASSPATH}"
    done
fi
# Don't be a bitch, java
export CLASSPATH="${CLASSPATH}:."

### PATH and MANPATH currently handled by .xinitrc (need PATH anyways)
typeset -U path
if [ -d ${HOME}/opt ]; then
    for i in ${HOME}/opt/*/bin; do
        PATH="$i:${PATH}"
    done
#    for i in ${HOME}/opt/*/man; do
#        MANPATH="$i:${MANPATH}"
#    done
fi
if [ -d /opt ]; then
    for i in /opt/*/bin; do
        PATH="$i:${PATH}"
    done
#    for i in /opt/*/share/man; do
#        MANPATH="$i:${MANPATH}"
#    done
fi

### Mail
mailprefix=~/.maildir
mailpath=(
    $mailprefix
    $mailprefix/.uni'?New mail in uni'
    $mailprefix/.uni.someone'?Someone sent mail'
    $mailprefix/.uni.ISCL'?New mail in ISCL')

### MPD
export MPD_HOST="brmbr"

### History
HISTFILE=~/.history
HISTSIZE=4000
SAVEHIST=2000

### PUSHD History
DIRSTACKSIZE=10

## Prompt
autoload -U promptinit
promptinit
PS1="%{${fg[green]}${bg[default]}%}%B[%b %{${fg[yellow]}${bg[default]}%}%D{%H:%M:%S} %B%(?..%{${fg[red]}${bg[default]}%}%? )%{${bg[default]}${fg[green]}%}] %#%b %{${fg[white]}${bg[default]}%}"
RPS1="%B%{${fg[blue]}${bg[default]}%}%~%{${fg[green]}${bg[default]}%})-"

### OPTIONS
###########

## History
setopt incappendhistory
setopt dvorak
setopt correct
setopt extendedhistory
setopt histignoredups
setopt histallowclobber
setopt histignorespace
setopt autopushd

## Misc
setopt noclobber
setopt autocd

### Aliases
###########

# color for different kinds of documents
eval `dircolors`

### Simple command aliases
alias vi=vim
alias ls='ls --color="auto" -CFB' ll='ls -lh' la='ls -A' lsd='ls -d' l='ls'
alias mkdir='nocorrect mkdir -p' touch 'nocorrect touch'
alias du='du -h' df='df -h'
alias umerge='emerge -C'
alias iwscan="/sbin/iwlist  scan"

alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'

alias stop='mpc stop' prev='mpc prev' next='mpc next' toggle='mpc toggle' playlist='mpc playlist' listall='mpc listall'
alias mpc="mpc --format '%artist%: %album% - %track% %title% (%time%)'"

alias cpu='ps aux | sort -k 3,3 | tail '  
alias mem='ps aux | sort -k 4,4 | tail '  

alias cdrecord='sudo cdrecord driveropts=burnfree --verbose dev=/dev/hdb'

### Suffix aliases
alias -s tex=gvim cpp=gvim java=gvim xml=gvim php=gvim 
alias -s html=firefox 
alias -s jpg=feh jpeg=feh png=feh gif=feh

## Directory hashes
hash -d early=~/dat/src/early # Early parser
hash -d wp=~/dat/wallpapers 

# common typos
alias iv=vi

### Global aliases

### Completion
##############

autoload -U compinit
compinit

### Keybindings
###############

bindkey '^p' history-search-backward
bindkey '^n' history-search-forward

### Arch

alias pacs="pacsearch"
pacsearch () {
    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' )"
}


### Cache

zstyle ':completion::complete:*' use-cache 1

Guy #1: I'd totally hit that.
Guy #2: Dude, I'd hit that so hard whoever could pull me out would become the King of England.
--College Walk, Columbia University (Overheard in NY)

Offline

#4 2007-12-23 15:55:59

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: Share your bashrc!

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

alias ll='ls -lh'
alias la='ls -lah'
alias ..='cd ..'
alias pacman='LANG=C pacman'

export XDG_CONFIG_DIRS=/etc/xdg/:/opt/kde/etc/xdg
export XDG_CONFIG_HOME="$HOME/.config/"
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share/

Offline

#5 2007-12-23 16:09:23

3nd3r
Member
From: /dev/null
Registered: 2002-12-08
Posts: 301
Website

Re: Share your bashrc!

alias ls='ls --color=auto'
# coloured pacman output
alias pacs="pacsearch"
pacsearch () {
       echo -e "$(pacman -Ss $@ | sed \
       -e 's#current/.*#\\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' )"
}
# safety copy, delete & colour
alias rm='rm -i'
alias cp='cp -iv'
alias mv='mv -i'
alias ..="cd .."
alias cl="clear"
alias ll="ls -lhav"
alias ls="ls -v --color=auto"
alias df="df -h"
alias du="du -hc"
alias mv="mv -iv"
alias cp="cp -v"

#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 -rf /tmp/list
}

#myip - finds your current IP if your connected to the internet
myip ()
{
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' 
}

#clock - A bash clock that can run in your terminal window.
clock ()
{
while true;do clear;echo "===========";date +"%r";echo "===========";sleep 1;done
}

#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=`lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' `
echo "${myip}"
echo "---------------------------------------------------"
}

#shot - takes a screenshot of your current window
shot ()
{
import -frame -strip -quality 75 "$HOME/$(date +%s).png"
}

#bu - Back Up a file. Usage "bu filename.txt" 
bu () { cp $1 ${1}-`date +%Y%m%d%H%M`.backup ; }




export PS1="[\e[31m\$(pwd)\e[0m :: \e[32m\@\e[0m :: \e[33m\l\e[0m]\n[\e[32m\u\e[0m@\e[34m\H\e[0m] \$ "

Offline

#6 2007-12-23 16:27:10

Gilneas
Member
From: Netherlands
Registered: 2006-10-22
Posts: 320

Re: Share your bashrc!

df -h
export HISTIGNORE="&:[bf]g:exit"
export HISTCONTROL=ignoredups
export HISTFILESIZE=99999
export HISTSIZE=99999
eval $(dircolors -b ~/.dircolors)

PS1='--> '
alias ls='ls --color=always -A -h -l --group-directories-first -F'
alias mm='feh -T mm'
alias p='pwd'
alias ..='cd ..'
alias less='less -iF'
alias mo='mplayer -loop 0 -vo none'
alias ed='rlwrap -D2 -s10000 ed'
alias nsf='aoss nosefart'
alias xi='atool -l'
alias x='atool -x'
alias md='aoss mikmod -lc'
alias tree='tree -C'


function l() {
        ls "$@"
        pwd
}

function v() {
        if [ ! -f "$1" ]; then
                echo 'needs a file'
        fi
        mplayer "$1"
        mv "$1" v"$1"
}

function wt() {
        [ -f "$2" ] && while true; do "$1" "$2"; done
}

source $HOME/.paths

sed -e 's#^\(\w*\) \(.*\)$#export \1=\2#' $HOME/.bwrc > $HOME/bookmarks.sh
sed -e 's#^\(\w*\) .*$#function \1() { cd "$\1" \&\& l; }#' $HOME/.bwrc >> $HOME/bookmarks.sh
source $HOME/bookmarks.sh

Offline

#7 2007-12-23 16:33:04

darkarchon
Member
From: Israel
Registered: 2007-02-28
Posts: 44

Re: Share your bashrc!

alias ls='ls --color=auto'
alias rm='rm -iv'
alias mv='mv -iv'
alias cp='cp -iv'
alias ..='cd ..'
alias usd='wine /home/arqon/USDownloader-Lite/USDownloader.exe'
alias m='mplayer'
alias gm='gmplayer'
alias lla='ls -la'
alias ll='ls -l'
alias la='ls -a'
alias dls='cd $HOME/downloads'
alias e='cd /mnt/sda5'
alias f='cd /mnt/sdb5'
alias tSs='tupac -Ss'
alias tS='tupac'
alias Qs='yaourt -Qs'
alias ySs='yaourt -Ss'
alias yS='yaourt -S'
alias Rsc='pacman -Rsc'
alias Qo='yaourt -Qo'
alias Ql='pacman -Ql'
alias Qi='pacman -Qi'
alias Si='yaourt -Si'
alias Syu='yaourt -Syu --aur'
#alias stime='name "$(exec date)"'
export EDITOR="vi"
export OOO_FORCE_DESKTOP=gnome
export PATH=$PATH:$HOME/scripts


k="\033[0;30m"    # black
r="\033[0;31m"    # red
R="\033[1;31m"    # RED
g="\033[0;32m"    # green
y="\033[0;33m"    # yellow
b="\033[0;34m"    # blue
B="\033[1;34m"    # BLUE
m="\033[0;35m"    # magenta
c="\033[0;36m"    # cyan
C="\033[1;36m"    # CYAN
w="\033[0;37m"    # white
NC="\033[0;0m"    # No Color

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


# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

PS1='\[\e[1;35m\]\u\[\e[m\] \[\e[1;36m\]\w\[\e[m\] \[\e[1;32m\]> \[\e[m\]\[\e[0;37m\]'
PS2='>'
cd ~
echo -e "                ${C}Hello ${r}and ${C}Welcome"

Offline

#8 2007-12-23 17:26:48

elide
Member
From: Russia
Registered: 2007-12-02
Posts: 40

Re: Share your bashrc!

Jansson wrote:

alias g++='g++ -Wall -pedantic'

+1 (;

[ "x$SSH_CLIENT" == "x" ] && {
        PS1='\u@\h| \w \[\033[40m\033[1;32m\]>> \[\033[0m\]'
} || {
        PS1='\u@\[\033[40m\033[1;33m\]\h\[\033[0m\]| \w \[\033[40m\033[1;33m\]>> \[\033[0m\]'
}
export PS1

function cd(){
        [ -z "$1" ] && pushd $HOME || pushd "$1"
}
alias cdd='popd'

function mkdc(){ 
        [ -e "$1" ] || mkdir -p "$1"
        cd "$1"
}

function tjd(){
        bn=`basename "$1"`
        t=`date +%Y%m%d_%H%M`
        tar cjf "$bn.$t.tar.bz2" "$1"
}

boring stuff skipped.

Offline

#9 2007-12-26 12:26:21

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: Share your bashrc!

darkarchon, I snaged your promt code! I couldn't help myself. It was too pretty and looks great on my system. I hope you don't mind : )

Most of this stuff I found while surfing around. I spent alot of time juggling Chinese and English locales, and I need to clean this thing up a bit, but everything works. *knock on wood*

I know my alias' are weird, but I just got too frustrated having to typ caps all the time, and always miss-spelling yoaurt, so I eliminated that problem  smile

PS1='\[\e[1;35m\]\u\[\e[m\] \[\e[1;36m\]\w\[\e[m\] \[\e[1;32m\]> \[\e[m\]\[\e[0;37m\]'
PS2='>'
echo -e "                ${C}Welcome ${r}to ${C}Linux"

test -n "$DISPLAY" && export TERM=xterm-color

#Note..  LC_ALL, overrides all other locale settings.
#export LC_ALL="zh_CN.UTF-8"
#export LANG="zh_CN.UTF-8"
#export LC_CTYPE="en_US.UTF-8"
#export LC_CTYPE="zh_CN GB2312"
export LANG="en_US.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"

#Note.. If not set, environment defaults to LANG=.
#ENCODING="UTF-8"
#export LC_MESSAGES=en_US.UTF-8
#export LC_TIME=en_US.UTF-8
#export LC_COLLATE=C
#export LC_NUMERIC=en_US.UTF-8
#export LC_MONETARY=en_US.UTF-8
#export LC_PAPER=en_US.UTF-8
#export LC_NAME=en_US.UTF-8
#export LC_ADDRESS=en_US.UTF-8
#export LC_TELEPHONE=en_US.UTF-8
#export LC_MEASUREMENT=en_US.UTF-8
#export LC_IDENTIFICATION=en_US.UTF-8

#Using scim for Chinese input.
export QT_XFT=true
#export GDK_USE_XFT=1
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="xim"
export XIM_PROGRAM="scim -d"
#scim -f socket -c socket -d

export EDITOR="vi"

alias ..="cd .."
alias cd..='cd ..'
alias ls='ls --color=auto'

#simplify yaourt commands using lowercase.

alias y-syu='yaourt -Syu --aur' #sync refresh sys update + aur
alias y-sy='yaourt -Sy'         #sync refresh
alias y-s='yaourt -S'           #install
alias y-sb='yaourt -Sb'         #builds the targets from source
alias y-su='yaourt -Su --aur'   #upgrade all aur packages
alias y-r='yaourt -R'           #remove
alias y-rd='yaourt -Rd'         #remove omit dependencies
alias y-rs='yaourt -Rs'         #remove plus unused dependencies
alias y-sl='yaourt -Sl'         #list all packages in specified repository
alias y-si='yaourt -Si'         #view package / aur PKGBUILD info
alias y-u='yaourt -U'           #install local pkg
alias y-scc='yaourt -Scc'       #clean catch - all pkgs
alias y-sc='yaourt -Sc'         #clean catch - old pkgs only
alias y-ss='yaourt -Ss'         #query database
alias y-qs='yaourt -Qs'         #query installed only
alias y-qi='yaourt -Qi'         #pkg more info
alias y-qe='yaourt -Qe'         #look for installed orphans
alias y-ql='yaourt -Ql'         #find pkg file list
alias y-qo='yaourt -Qo'         #/path/to/file = find owner
alias y-sw='yaourt -Sw'         #download but don't install
alias y-sf='yaourt -Sf'         #reinstall - for dep problem "force"

#just incase I do need to type yaourt..
alias yoaurt='yaourt'
alias yuaort='yaourt'
alias youart='yaourt'
alias yauort='yaourt'
alias yuoart='yaourt'

#simplify pacman commands using lowercase.
#Need to install and configure sudo.

alias p-s='sudo pacman -S'      #install
alias p-sy='sudo pacman -Sy'    #sync refresh
alias p-syu='sudo pacman -Syu'  #sync refresh sys update
alias p-r='sudo pacman -R'      #remove
alias p-u='sudo pacman -U'      #install local pkg
alias p-rd='sudo pacman -Rd'    #remove omit dependencies
alias p-rs='sudo pacman -Rs'    #remove plus unused dependencies
alias p-scc='sudo pacman -Scc'  #clean catch - all pkgs
alias p-sc='sudo pacman -Sc'    #clean catch - old pkgs only
alias p-ss='sudo pacman -Ss'    #query database
alias p-qs='sudo pacman -Qs'    #query installed only
alias p-si='sudo pacman -Si'    #pkg info
alias p-qi='sudo pacman -Qi'    #pkg more info
alias p-qe='sudo pacman -Qe'    #look for installed orphans
alias p-ql='sudo pacman -Ql'    #find pkg file list
alias p-qo='sudo pacman -Qo'    #/path/to/file = find owner
alias p-sw='sudo pacman -Sw'    #download but don't install
alias p-sf='sudo pacman -Sf'    #reinstall - for dep problem
alias abs='sudo abs'            #update abs database
alias p-op='sudo pacman-optimize'

#arch32 chroot - simplify yaourt commands using lowercase.
#Need to build and install yaourt inside chroot.

alias ay-syu='sudo chroot /opt/arch32 yaourt -Syu --aur'
alias ay-sy='sudo chroot /opt/arch32 yaourt -Sy'
alias ay-s='sudo chroot /opt/arch32 yaourt -S'
alias ay-sb='sudo chroot /opt/arch32 yaourt -Sb'
alias ay-su='sudo chroot /opt/arch32 yaourt -Su --aur'
alias ay-r='sudo chroot /opt/arch32 yaourt -R'
alias ay-rd='sudo chroot /opt/arch32 yaourt -Rd'
alias ay-rs='sudo chroot /opt/arch32 yaourt -Rs'
alias ay-sl='sudo chroot /opt/arch32 yaourt -Sl'
alias ay-si='sudo chroot /opt/arch32 yaourt -Si'
alias ay-u='sudo chroot /opt/arch32 yaourt -U'
alias ay-scc='sudo chroot /opt/arch32 yaourt -Scc'
alias ay-sc='sudo chroot /opt/arch32 yaourt -Sc'
alias ay-ss='sudo chroot /opt/arch32 yaourt -Ss'
alias ay-qs='sudo chroot /opt/arch32 yaourt -Qs'
alias ay-qi='sudo chroot /opt/arch32 yaourt -Qi'
alias ay-qe='sudo chroot /opt/arch32 yaourt -Qe'
alias ay-ql='sudo chroot /opt/arch32 yaourt -Ql'
alias ay-qo='sudo chroot /opt/arch32 yaourt -Qo'
alias ay-sw='sudo chroot /opt/arch32 yaourt -Sw'
alias ay-sf='sudo chroot /opt/arch32 yaourt -Sf'

#arch32 chroot - simplify pacman commands using lowercase.

alias ap-s='sudo chroot /opt/arch32 pacman -S'
alias ap-sy='sudo chroot /opt/arch32 pacman -Sy'
alias ap-syu='sudo chroot /opt/arch32 pacman -Syu'
alias ap-r='sudo chroot /opt/arch32 pacman -R'
alias ap-u='sudo chroot /opt/arch32 pacman -U'
alias ap-rd='sudo chroot /opt/arch32 pacman -Rd'
alias ap-rs='sudo chroot /opt/arch32 pacman -Rs'
alias ap-scc='sudo chroot /opt/arch32 pacman -Scc'
alias ap-sc='sudo chroot /opt/arch32 pacman -Sc'
alias ap-qs='sudo chroot /opt/arch32 pacman -Qs'
alias ap-ss='sudo chroot /opt/arch32 pacman -Ss'
alias ap-qs='sudo chroot /opt/arch32 pacman -Qs'
alias ap-si='sudo chroot /opt/arch32 pacman -Si'
alias ap-qi='sudo chroot /opt/arch32 pacman -Qi'
alias ap-qe='sudo chroot /opt/arch32 pacman -Qe'
alias ap-ql='sudo chroot /opt/arch32 pacman -Ql'
alias ap-qo='sudo chroot /opt/arch32 pacman -Qo'
alias ap-sw='sudo chroot /opt/arch32 pacman -Sw'
alias ap-sf='sudo chroot /opt/arch32 pacman -Sf'
alias ap-op='sudo chroot /opt/arch32 pacman-optimize'
alias aabs='sudo chroot /opt/arch32 abs'

#misc alias
alias ut='urxvt'
alias mt='mlterm'
alias abi='abiword'
alias oo='/opt/openoffice/program/soffice -writer'

#I need to move ch script to bin.
#alias chabi='ch abiword'
#alias choo='ch /opt/openoffice/program/soffice -writer'

#ch: Start application with Chinese environment.
function ch()
{
if [ -z "$1" ]; then
  echo "Usage: $0 app arg1 arg2 ... "
  exit 1
fi
export LANG=zh_CN
PROG=$1
shift
exec $PROG $* 
}

#en: Start application with English environment
function en()
{
if [ -z "$1" ]; then
  echo "Usage: $0 app arg1 arg2 ... "
  exit 1
fi
export LANG=en_US
PROG=$1
shift
exec $PROG $* 
}

#shot - takes a screenshot of your current window
function shot()
{
import -frame -strip -quality 100 "$HOME/screenshots/$(date +%s).png"
}

#netinfo - shows network information for your system
function 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=`lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' `
echo "${myip}"
echo "---------------------------------------------------"
}

# Define a word - USAGE: define word
function 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
}

#Check spelling of a word - USAGE: spell word
function spell()
{
echo $@ | ispell -a | sed -n -e '/^\&/p' -e '/^\#/p';
}

#babies - Tries to unarchive anything.
function babies()
{
local FILENAME="${1}"
local FILEEXTENSION=`echo ${1} | cut -d. -f2-`
case "$FILEEXTENSION" in
 tar)
   tar xvf "$FILENAME";;
 tar.gz)
   tar xzvf "$FILENAME";;
 tgz)
   tar xzvf "$FILENAME";;
 gz)
   gunzip "$FILENAME";;
 tbz)
   tar xjvf "$FILENAME";;
 tbz2)
   tar xjvf "$FILENAME";;
 tar.bz2)
   tar xjvf "$FILENAME";;
 tar.bz)
   tar xjvf "$FILENAME";;
 bz2)
   bunzip2 "$FILENAME";;
 tar.Z)
   tar xZvf "$FILENAME";;
 Z)
   uncompress "$FILENAME";;
 zip)
   unzip "$FILENAME";;
 rar)
   unrar x "$FILENAME";;
esac
}

# Filenames to lowercase. Ex.. lowercase * = All file in the current dir.
function lowercase()  
{
 for file ; do
  filename=${file##*/}
  case "$filename" in
     */*) dirname==${file%/*} ;;
      *) dirname=.;;
  esac
  nf=$(echo $filename | tr A-Z a-z)
  newname="${dirname}/${nf}"
  if [ "$nf" != "$filename" ]; then
      mv "$file" "$newname"
      echo "lowercase: $file --> $newname"
  else
      echo "lowercase: $file not changed."
  fi
done
}

# System Info
function sysinfo()  
{
clear
num_cpus=`cat /proc/cpuinfo | grep -c "model name"`
machine_cpu=`cat /proc/cpuinfo | grep -m 1 "model name" | cut -d: -f2`
machine_mhz=`cat /proc/cpuinfo | grep -m 1 "cpu MHz" | cut -d: -f2`
machine_cpuinfo=`uname -mp`
todays_date=`date +"%D %r"`
machine_uptime=`uptime`
machine_ram=`cat /proc/meminfo | grep -m 1 "MemTotal:" | cut -d: -f2 |  sed 's/^[ \t]*//'`
machine_video=`lspci | grep -m 1 "VGA" | cut -d: -f3 |  sed 's/^[ \t]*//'`
machine_eth_card=`lspci | grep -m 1 "Ethernet" | cut -d: -f3 |  sed 's/^[ \t]*//'`
machine_audio_controller=`lspci | grep -m 1 "audio" | cut -d: -f3 |  sed 's/^[ \t]*//'`
arch_damons=`grep "DAEMONS=" /etc/rc.conf `
last_logins=`last | head`
eth0info=`ifconfig eth0 | grep "inet addr:" | sed 's/inet addr/Local IP/g' | sed 's/^[ \t]*//;s/[ \t]*$//'`

echo "ARCH LINUX - Machine Information Script ver .10"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "DATE: $todays_date   MACHINE NAME: $HOSTNAME  "
echo " "
echo "Eth0: $eth0info"
echo "ETHERNET CARD: $machine_eth_card"
echo "CPU INFO: Qty=$num_cpus $machine_cpuinfo" 
echo "VIDEO CARD: $machine_video"
echo "AUDIO CONTROLLER: $machine_audio_controller"
echo "RAM INFO: $machine_ram" 
echo " "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
route
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "DISK USAGE:"
df -h
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "UPTIME: $machine_uptime"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "$arch_damons"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}

export GTK2_RC_FILES=$HOME/.gtkrc-2.0

Last edited by Leigh (2007-12-30 09:50:50)


-- archlinux 是一个极好的 linux

Offline

#10 2007-12-26 12:41:24

sessy
Member
Registered: 2006-01-20
Posts: 104

Re: Share your bashrc!

A few interesting lines:

# http://richbradshaw.wordpress.com/2007/11/25/bash-tips-and-tricks/
# This makes bash append history instead of overwriting it, and makes it so
# that each time the prompt is shown it writes out all the history.
shopt -s histappend
PROMPT_COMMAND='history -a'
# no duplicate commands
HISTCONTROL=ignoredups

alias bedit="vim ~/.bashrc; source ~/.bashrc"
alias vimrc='vim ~/.vimrc'
alias ff="find ./ -type f | grep -v \.svn | xargs grep -C1 --color=auto"
alias svn-add-all-new-files="svn st|grep ^?|sed s/?//|xargs svn add $1"

Plus a few from my ~/.inputrc:

"SS":"sudo "
"SV":"sudo vim "
"SP":"sudo pacman "

(so I only have to type SP and sudo pacman appears on the command line)

Offline

#11 2007-12-26 18:30:16

tch
Member
From: Slovakia
Registered: 2007-10-07
Posts: 31

Re: Share your bashrc!

Heres my .zshrc
some of the stuff ( pacsearch ) was taken from the previous posts.

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=5000
setopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/tch/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

##################
# CUSTOM OPTIONS #
##################

if [[ $SHLVL == 1 ]]; then
        PATH=$PATH:~/bin
fi

autoload zkbd
[[ ! -d ~/.zkbd ]] && mkdir ~/.zkbd
[[ ! -f ~/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd
source  ~/.zkbd/$TERM-$VENDOR-$OSTYPE
# setup key accordingly
[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"   ]]  && bindkey  "${key[Right]}"   forward-char

### ALIASES ###
alias ls='ls --color=auto -hF'
alias ll='ls -l'
alias la='ls -al'
alias gdb='gdb -q'
alias cls='clear'
alias grep='grep -n --color=auto'

### FUNCTIONS ###
function mkcd()         { mkdir "$1" && cd "$1"; }
function dec()          { printf "%d\n" $1}
function hex()          { printf "0x%08x\n" $1}
function mktar()        { tar czf "${1%%/}.tar.gz" "${1%%/}/"; }
function rot13()        { echo "$@" | tr a-zA-Z n-za-mN-ZA-M; }
function md5()          { md5.pl $* }
function getip()        { lynx -dump http://whatismyip.org/ }

function x()
{
    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
}

### COLORS ###
fg_green=$'%{\e[0;32m%}'
fg_blue=$'%{\e[0;34m%}'
fg_cyan=$'%{\e[0;36m%}'
fg_red=$'%{\e[0;31m%}'
fg_brown=$'%{\e[0;33m%}'
fg_purple=$'%{\e[0;35m%}'

fg_light_gray=$'%{\e[0;37m%}'
fg_dark_gray=$'%{\e[1;30m%}'
fg_light_blue=$'%{\e[1;34m%}'
fg_light_green=$'%{\e[1;32m%}'
fg_light_cyan=$'%{\e[1;36m%}' 
fg_light_red=$'%{\e[1;31m%}'
fg_light_purple=$'%{\e[1;35m%}'
fg_no_colour=$'%{\e[0m%}'

fg_white=$'%{\e[1;37m%}'
fg_black=$'%{\e[0;30m%}'

### PROMPT ###
PS1="${fg_cyan}%m ${fg_light_green}%~ ${fg_white}%# ${fg_no_colour}"

pacsearch () {
    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' )"
}

and heres md5.pl which is my ~/bin:

#!/usr/bin/perl
use warnings;
use Digest::MD5 'md5_hex';
foreach $data ( @ARGV ) {
        print "$data:", md5_hex( $data ), "\n";
}

Offline

#12 2007-12-26 23:16:46

synorgy
Member
From: $HOME
Registered: 2005-07-11
Posts: 272
Website

Re: Share your bashrc!

really really simple:

alias ls='ls --color=auto --group-directories-first'
PS1='\@ \[\033[0;32m\] \w\[\033[0m\]> '

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity." (Dennis Ritchie)

Offline

#13 2007-12-26 23:47:49

dum8d0g
Member
Registered: 2007-10-23
Posts: 7

Re: Share your bashrc!

> cat .bashrc
# ALIASES
        # ls #
alias ls='ls -F --color=auto'
alias sl='ls -F --color=auto'
alias l='ls -F --color=auto'
alias ll='ls -lhF --color'
        # cd #
alias cd..='cd ..'
alias ..='cd ..'
        # other #
alias e='exit'
alias grep='grep --color'
alias k='killall'
alias die='killall mplayer'
alias mc='env LANG=C mc'
alias man='env LANG=C man'
alias fuckoff='killall -9 firefox-bin'
alias vim='vim -p'
alias wim='vim -p +"colorscheme dum8d0g2"'
alias vimp='vim +Project'
alias c='cat'
alias m='mocp'
        # pacman #
alias i='sudo pacman -S'
alias f='pacman -Ss'
alias u='sudo pacman -Syu'
alias R='sudo pacman -Rcsn'
# mount #
alias mfl='mount /mnt/fl/'
alias ufl='umount /mnt/fl/'

# VARIABLES
PS1='> '
HISTSIZE='1000'
EDITOR='vim'

# FUNCTIONS
mcd () {
        mkdir -p "$*" && cd "$*"
}

# STARTUP
set b off
xset b off
#/usr/bin/fortune cs
#echo
. /etc/bash_completion

>

Offline

#14 2007-12-27 00:55:08

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: Share your bashrc!

mine:

# 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
shopt -s cdspell

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# enable programmable completion features
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    export LS_OPTIONS='--color=auto'
    eval `dircolors ~/.dircolors` ## sets LS_COLORS to the values in
                                  ## ~/.dircolors
fi

# color prompt

PS1='\[\033[00;33m\]\u\[\033[00m\]@\[\033[00;32m\]\h\[\033[00m\]:\[\033[00;36m\]\w\[\033[00m\] \$ '

# titlebar
# export PS1=$PS1"\[\e]0;\u@\H:\w\a\]"

# 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

# add executable paths
export PATH=$PATH:$HOME/.PersonalBin
export PATH=$PATH:$HOME/.PersonalBin/mutt

unset MAILCHECK

export EDITOR="vim"
export BROWSER="nice -n -5 firefox"
#export OOO_FORCE_DESKTOP=gnome
export OOO_FORCE_DESKTOP=kde

##  some functions

function s {
if [[ $1 ]]; then
    screen -dRR -S $HOSTNAME.$1
else
    screen -ls
fi
}

# ls -* aliases
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -lh'
alias la='ls $LS_OPTIONS -A'
alias lf="ls $LS_OPTIONS -F"
alias llf="ls $LS_OPTIONS -lp"
alias lla='ls $LS_OPTIONS -lAh'
alias lld="ls $LS_OPTIONS -ldh"
alias llt="ls $LS_OPTIONS -lht"
alias lls="ls $LS_OPTIONS -lhS"

# security aliases
alias mv="mv -i"
alias rm="rm -i"
alias cp="cp -iavx"

# human readable
alias df="df -h"
alias du="du -mh"

# miscellaneous shortcuts
alias bc="bc -lq"
alias burn="bashburn"
alias chromium="export CHROMIUM_DATA="/usr/share/chromium/data"; chromium"
alias dstat="dstat -a -sm -N ppp0 -D hda"
alias ethstatus="ethstatus -i eth1 -S 16m"
alias firefox="nice -n -5 firefox"
alias gnump3d="gnump3d --fast --background --config /home/vlad/.gnump3d/gnump3d.conf"
alias gnump3log="multitail -M 0 /home/vlad/.gnump3d/log/error.log -I /home/vlad/.gnump3d/log/access.log"
alias grep="egrep --color=always -i"
alias gvim="gvim-tabbed"
alias less="less -Si"
alias man="man -a"
alias nano="nano -w"
alias rsync="rsync -avv"
alias search="psearch -a"
alias startx="startx -- -dpi 96"
alias truecrypt_mount="truecrypt -M uid=$(id -u),gid=$(id -g)"
alias wyrd="wyrd; remind -p -c ~/.reminders  | rem2html --nostyle  > ~/.reminders_calendar.html"
alias xxx="mutt"
alias zless="zless -Si"

# one-letter shortcuts
alias c="echo -e '\n\t\t' `date` && echo -e && cal -3m"
alias d="date"
alias r="rox"

# key bindings
bind "\C-f":forward-word
bind "\C-b":backward-word
bind "\C-d":kill-word
bind "\C-n":yank-last-arg
bind "\C-h?":backward-kill-word

but more interesting is the ~/.inputrc. there some really cool tweaks for work with bash or other *sh:
~/.inputrc:

 
set completion-ignore-case on

#set bind-tty-special-chars off

# first tab suggests ambiguous variants
set show-all-if-ambiguous on

# Be 8 bit clean.
set input-meta on
set output-meta on

# To allow the use of 8bit-characters like the german umlauts, comment out
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.
set convert-meta off

# ask before displaying more than 500 completions
set completion-query-item 500
# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
# the subset of the history starting with that text
# is searched (like 4dos for e.g.).
# Note to get rid of a line just Ctrl-C
"\e[B": history-search-forward
"\e[A": history-search-backward

# All of the following map the escape sequence of the
# value contained inside the 1st argument to the
# readline specific functions

#   urxvt
"\eOd": backward-word
"\eOc": forward-word
#   xterm
"\e[1;5C": forward-word
"\e[1;5D": backward-word
#"\e\e[5C": forward-word
#"\e\e[5D": backward-word
#"\e\e[C": forward-word
#"\e\e[D": backward-word

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
#"\e[3~": delete-char
"\e[2~": quoted-insert
#"\C-h?": backward-kill-word
"\C-h": backward-kill-word
"\C-?": backward-kill-word

# instead of showing a list of possible completions like bash does
# on default, TAB cycles through possible completions)
#"\t": menu-complete

$if Bash
  #do history expansion when space entered
  Space: magic-space
$endif

vlad

Offline

#15 2008-01-05 15:33:07

Agent69
Member
Registered: 2006-05-26
Posts: 189

Re: Share your bashrc!

Here is mine:

alias ls='ls -F --color=never'
alias la='ls -aF --color=never'
alias ll='ls -lhF --color=never'
alias wp='feh --bg-center'
alias ff='/opt/mozilla/bin/firefox &'
PS1='[\W]\$ '

Offline

#16 2008-01-05 15:39:01

smurnjiff
Member
Registered: 2007-06-25
Posts: 211

Re: Share your bashrc!

tch wrote:

Heres my .zshrc
some of the stuff ( pacsearch ) was taken from the previous posts.

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=5000
setopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/tch/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

##################
# CUSTOM OPTIONS #
##################

if [[ $SHLVL == 1 ]]; then
        PATH=$PATH:~/bin
fi

autoload zkbd
[[ ! -d ~/.zkbd ]] && mkdir ~/.zkbd
[[ ! -f ~/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd
source  ~/.zkbd/$TERM-$VENDOR-$OSTYPE
# setup key accordingly
[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"   ]]  && bindkey  "${key[Right]}"   forward-char

### ALIASES ###
alias ls='ls --color=auto -hF'
alias ll='ls -l'
alias la='ls -al'
alias gdb='gdb -q'
alias cls='clear'
alias grep='grep -n --color=auto'

### FUNCTIONS ###
function mkcd()         { mkdir "$1" && cd "$1"; }
function dec()          { printf "%d\n" $1}
function hex()          { printf "0x%08x\n" $1}
function mktar()        { tar czf "${1%%/}.tar.gz" "${1%%/}/"; }
function rot13()        { echo "$@" | tr a-zA-Z n-za-mN-ZA-M; }
function md5()          { md5.pl $* }
function getip()        { lynx -dump http://whatismyip.org/ }

function x()
{
    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
}

### COLORS ###
fg_green=$'%{\e[0;32m%}'
fg_blue=$'%{\e[0;34m%}'
fg_cyan=$'%{\e[0;36m%}'
fg_red=$'%{\e[0;31m%}'
fg_brown=$'%{\e[0;33m%}'
fg_purple=$'%{\e[0;35m%}'

fg_light_gray=$'%{\e[0;37m%}'
fg_dark_gray=$'%{\e[1;30m%}'
fg_light_blue=$'%{\e[1;34m%}'
fg_light_green=$'%{\e[1;32m%}'
fg_light_cyan=$'%{\e[1;36m%}' 
fg_light_red=$'%{\e[1;31m%}'
fg_light_purple=$'%{\e[1;35m%}'
fg_no_colour=$'%{\e[0m%}'

fg_white=$'%{\e[1;37m%}'
fg_black=$'%{\e[0;30m%}'

### PROMPT ###
PS1="${fg_cyan}%m ${fg_light_green}%~ ${fg_white}%# ${fg_no_colour}"

pacsearch () {
    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' )"
}

and heres md5.pl which is my ~/bin:

#!/usr/bin/perl
use warnings;
use Digest::MD5 'md5_hex';
foreach $data ( @ARGV ) {
        print "$data:", md5_hex( $data ), "\n";
}

Thanks for that: I couldn't get my delete key to work but now it does!

Offline

#17 2008-01-05 16:40:46

Shaika-Dzari
Member
From: Québec, Canada
Registered: 2006-04-14
Posts: 436
Website

Re: Share your bashrc!

dum8d0g wrote:

alias die='killall mplayer'
alias fuckoff='killall -9 firefox-bin'

lol

Any problem with mplayer and firefox?

Offline

#18 2008-01-05 16:42:43

gunnihinn
Member
From: Torreón, Mexico
Registered: 2007-10-28
Posts: 81

Re: Share your bashrc!

sessy wrote:

Plus a few from my ~/.inputrc:

"SS":"sudo "
"SV":"sudo vim "
"SP":"sudo pacman "

(so I only have to type SP and sudo pacman appears on the command line)

I love you. Seriously.

I stole most of the stuff in mine from various threads here, so most of it's already been posted. I quite like this little function though:

# go to dir, run ls
cdl (){
    cd $1 && ls
}

Great if you use the shell as a file manager. big_smile

Offline

#19 2008-01-06 19:23:49

kraluz
Member
From: Aveiro, Portugal
Registered: 2008-01-01
Posts: 30

Re: Share your bashrc!

Shaika-Dzari wrote:
dum8d0g wrote:

alias die='killall mplayer'
alias fuckoff='killall -9 firefox-bin'

lol

Any problem with mplayer and firefox?

Probably the same ones everybody has... never had an alias made me laugh so much, though... lol

Offline

#20 2008-01-16 14:29:19

dum8d0g
Member
Registered: 2007-10-23
Posts: 7

Re: Share your bashrc!

My aliases to kill mplayer & firefox are made for two reasons: Im killing mplayer, beause Im playing radios in background, so to stop it quickly.. And firefox.. hmm.. firefox :-) But from the version ff3 (nightly build, fresh rolling updates) can I remove this alias..

Offline

#21 2008-01-16 14:37:08

barry
Member
Registered: 2007-11-27
Posts: 39

Re: Share your bashrc!

nothing too fancy here..

alias ls='ls -lh --color=auto'
alias df='df -m'
alias du='du -m'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -i'
alias mkdir='mkdir -p'

# shortened commands
alias tre='transmission-remote'

# Screen sessions

alias sxt='screen -x torrent'
alias sxm='screen -x mail'

PS1="[\u@\h \w]$ "

export OOO_FORCE_DESKTOP=gnome

Offline

#22 2008-08-30 19:01:27

haxit
Member
From: /home/haxit
Registered: 2008-03-04
Posts: 1,247
Website

Re: Share your bashrc!

Mine is too long sad


Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.

Offline

#23 2008-09-02 01:22:42

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Share your bashrc!

Only the possibly interesting lines (haven't seen these yet, above):

alias emacs='emacs -nw'
alias nsl='netstat -alnp --protocol=inet | grep -v CLOSE_WAIT | cut -c-6,21-94 | tail +2'
alias whois='whois -H'
alias psp='ps aux | grep -v grep | grep '
alias pst='ps -eww f'

My fav. is 'psp'

Offline

#24 2008-09-02 07:59:49

ukognos
Member
Registered: 2008-07-18
Posts: 41

Re: Share your bashrc!

Here is my ~/.bashrc

source /etc/bash/bashrc

tongue

Ok here's the real one:

# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen !


# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
    # Shell is non-interactive.  Be done now!
    return
fi

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.  #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Enable history appending instead of overwriting.  #139609
shopt -s histappend

# Change the window title of X terminals 
case ${TERM} in
    xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
        ;;
    screen)
        PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
        ;;
esac

use_color=true

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS.  Try to use the external file
# first to take advantage of user additions.  Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs}    ]] \
    && type -P dircolors >/dev/null \
    && match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true

if ${use_color} ; then
    # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
    if type -P dircolors >/dev/null ; then
        if [[ -f ~/.dir_colors ]] ; then
            eval $(dircolors -b ~/.dir_colors)
        elif [[ -f /etc/DIR_COLORS ]] ; then
            eval $(dircolors -b /etc/DIR_COLORS)
        fi
    fi

    if [[ ${EUID} == 0 ]] ; then
        PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
    else
        PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
    fi

    alias ls='ls --color=auto'
    alias grep='grep --colour=auto'
else
    if [[ ${EUID} == 0 ]] ; then
        # show root@ when we don't have colors
        PS1='\u@\h \W \$ '
    else
        PS1='\u@\h \w \$ '
    fi
fi

# Try to keep environment pollution down, EPA loves us.
unset use_color safe_term match_lhs


#alias
alias vi=vim
alias ll='ls -lh'

export OOO_FORCE_DESKTOP=gnome

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

LESSOPEN="|lesspipe.sh %s"; export LESSOPEN
export LC_LANG=en_EN.utf8

I think, i stole that file from my old gentoo box.:rolleyes:

Offline

#25 2008-09-02 08:57:38

cinan
Member
From: Slovakia
Registered: 2008-07-04
Posts: 251
Website

Re: Share your bashrc!

I think screens are useful smile

Offline

Board footer

Powered by FluxBB