Topic Contributors
creator avatar  
mreschke
Matthew Reschke
Site Developer
Created: Jul 17th, 2008
Updated: Feb 16th, 2012
File
Download Selected (zip)
Download Selected (tar.gz)
Edit
Select All
Select None
View
Detail
Detail Preview
Icons
Preview
Show Hidden
Hide Hidden
Full Manager
Reset Defaults
icon
all.bashrc
icon
bsd-all.bashrc
icon
linux-all.bashrc
icon
linux-arch.bashrc
Open In New Tab
Open In New Window
List Archive Contents
Download File
Open
Download Folder (as .zip)
Public Shell Profile
Post # 86 permalink Topic #86 by mreschke on 2008-07-17 14:26:01 (viewed 2,539 times)

My Custom bash profiles (aliases, functions, prompts) for Linux, BSD and Mac. These profiles are meant to be installed on your local machine. Read the installation instructions here Public Curl Installers. See my VIM and Linux Screen Command customization too.

Generic Unix Profile[-][- -][++]

(part of manup nwq/profile-base

all.bashrc
# Search mreschke.com mrticles via REST API
mr_topic () {
    url=http://mreschke.com/rest/v1
    if [ "$1" == "search" ]; then
        query=$2
        user=$3
    else 
        user=$2
    fi
 
    if [ "$user" == "" ]; then
        user=anonymous
        pass=anonymous
    else
        read -s -p "" pass
    fi
 
    if [ "$1" == "search" ]; then
        curl -u $user:$pass $url/search/$query?plaintext=1
    else
        curl -u $user:$pass $url/topic/$1.json?plaintext=1
    fi
    echo
}
 
 

Linux Profiles[-][- -][++]

linux-all.bashrc
#Linux Functions
function prompt01 {
    #toilet mreschke.com -F metal -f smslant
    #figlet 'mReschke Linux' -f smslant       
    #toilet 'mReschke.com' -F metal -d /usr/share/figlet/fonts/ -f smslant    
    #toilet 'mReschke.com EC2 Ubuntu' --metal 
    local BLUE="\[\033[0;34m\]"
    local DARK_BLUE="\[\033[1;34m\]"
    local RED="\[\033[0;31m\]"
    local DARK_RED="\[\033[1;31m\]"
    local BLACK="\[\033[0;30m\]"
    local GREEN="\[\033[0;32m\]"
    local CYAN="\[\033[0;36m\]"
    local PURPLE="\[\033[0;35m\]"
    local BROWN="\[\033[0;33m\]"
    local NO_COLOR="\[\033[0m\]"
    case $TERM in
        xterm*|rxvt*)
            TITLEBAR='\[\033]0;\u@\h:\w\007\]'
            ;;
        *)
            TITLEBAR=''
            ;;
    esac
    #PS1="\u@\h [\t]\$ "
    #PS1="${TITLEBAR}$BLUE\u$NO_COLOR@$BLUE\h $BROWN\w\n$BLUE<>>$NO_COLOR($GREEN"'\$'"$NO_COLOR)$RED>$NO_COLOR "
    PS1="${TITLEBAR}$DARK_BLUE\u$NO_COLOR@$CYAN\h $BROWN\w\n$BLUE<>>$NO_COLOR($GREEN"'\$'"$NO_COLOR)$RED>$NO_COLOR "
    PS2='continue-> '
    PS4='$0.$LINENO+ '
}
prompt01
 
#Linux Aliases
alias ls='/bin/ls -A --color=auto'
alias lls='/bin/ls -A --color=auto --group-directories-first'
alias lsl='/bin/ls -A --color=auto|less'
alias dir='/bin/ls -Hhal --color=auto'
alias dirg='/bin/ls -Hhal --color=auto|grep '
alias dird='/bin/ls -Hhal --color=auto --group-directories-first'
alias dirs='/bin/ls -HhalL --color=auto --group-directories-first'
alias dirl='/bin/ls -hal --color=auto --group-directories-first|less'
alias dirk='/bin/ls -kal --color=auto --group-directories-first'
alias dirb='/bin/ls -al --color=auto --group-directories-first'
 
alias openports='sudo lsof -P -i -n -sTCP:LISTEN'
alias openports2='sudo netstat -natl'
alias openports3='nmap -p 1-65535 --open localhost'
alias whatismyip='curl -s http://icanhazip.com/'
 
alias mv='time mv -fv'
alias rm='time rm -Irv'
alias cp='time cp --archive --verbose'
alias cpu='time cp --archive --update --verbose'
 
alias catl='grep -n "^"'
alias lines='sed "/^/=" | sed "N;s/\n/. /"'
 
alias dus='du -s'
alias duh='du -sh'
alias dul='du -h --max-depth=1'
 
alias df='df -T'
alias dfm='df -BM -T | grep -v none | grep -v udev'
alias dfh='df -h -T | grep -v none | grep -v udev'
 
alias raidstat='mdadm --misc --detail'
alias iostatall='iostat -dk 1'
alias iostatraid='iostat md0 md1 -dk 1'
 
alias locate='locate -i'
 
alias grep='/bin/grep -i --color=auto'
alias grep3='/bin/grep -A3 -B3 -i --color=auto'
alias igrep='/bin/grep -iv --color=auto'
alias egrep='/bin/grep -iE --color=auto'
alias fgrep='/bin/grep -iF --color=auto'
 
alias burn16='/usr/bin/cdrecord -v -dao speed=16'
alias burn24='/usr/bin/cdrecord -v -dao speed=24'
alias burn32='/usr/bin/cdrecord -v -dao speed=32'
alias burnerase='/usr/bin/cdrecord blank=fast'
 
alias fw='sudo /sbin/iptables -L --line-numbers'
 
alias rdesktop='rdesktop -g 1024x768 -z -x b -r clipboard:CLIPBOARD -r disk:root=/'
 
 

linux-arch.bashrc
#ArchLinux Functions
pacsearch () {
    echo -e "$(pacman -Ss $@ | sed -e 's#core/.*#\\033[1;31m&\\033[0;37m#g' -e
}
 
#ArchLinux Aliases
alias pacs='pacsearch'                      # Must have the pacsearch bash function, color coded searches
alias pacupg='sudo pacman -Syu'             # Synchronize with repositories before upgrading packages that are out of date on the local system.
alias pacin='sudo pacman -S'                # Install specific package(s) from the repositories
alias pacins='sudo pacman -Up'              # Install specific package not from the repositories as a file
alias pacre='sudo pacman -R'                # Remove the specified package(s), retaining its configuration(s) and required dependencies
alias pacrem='sudo pacman -Rns'             # Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrep='pacman -Si'                   # Display information about a given package in the repositories
alias pacreps='pacman -Ss'                  # Search for package(s) in the repositories
alias pacloc='pacman -Qi'                   # Display information about a given package in the local database
alias paclocs='pacman -Qs'                  # Search for package(s) in the local database
alias pacupd='sudo pacman -Sy && sudo abs'  # Update and refresh the local package and ABS databases against repositories
alias pacinsd='sudo pacman -S --asdeps'     # Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy'             # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
alias pachelp='cat /etc/nwq/profiles/alias.public | grep pac'
 

Linux .xinitrc / xsession[-][- -][++]

Sample of my ~/.xinitrc or ~/.xsession

~/.xinitrc
#!/bin/bash
######################################################################################################
## mReschke .xinitrc/.xsession X11 control file                                                     ##
## See http://fluxbox.sourceforge.net/docbook/en/html/app-setup.html for help on .xinitrc/.xsession ##
######################################################################################################
 
## Run before window manager loads ##
    # Fix to make QT apps look like GTK theme
    GTK2_RC_FILES="$HOME/.gtkrc-2.0"
 
    # Turn off screen blanking and turn on energy star features
    # screen blanking is cheap blank screensaver, backlight still on, dpms is actual monitor suspend
    # syntax: xset dpms standbytime suspendtime offtime
    xset s off
    xset dpms 600 600 600
 
    # Keyboard Repeat Rate
    xset r rate 250 50
    # For xmonad
    #trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 3 --transparent false --tint 0x000000 --height 11 &
    xrdb -merge .Xresources
    xsetroot -cursor_name left_ptr
 
## Launch window manager ##
    ck-launch-session enlightenment_start & wmpid=$!
 
## Run after window manager loads ##
    #sleep 1 && feh --bg-center /usr/share/wallpaper/img0.jpg &
    #sleep 1 && sshfs_mount_qserver
 
## Hang here until window manager closes ##
    wait $wmpid
 
## Run after window manager closes ##
 
 

BSD Profiles[-][- -][++]

bsd-all.bashrc
#BSD Functions
function prompt01 {
    #toilet mreschke.com -F metal -f smslant
    #figlet 'mReschke Linux' -f smslant       
    #toilet 'mReschke.com' -F metal -d /usr/share/figlet/fonts/ -f smslant    
    #toilet 'mReschke.com EC2 Ubuntu' --metal 
    local BLUE="\[\033[0;34m\]"
    local DARK_BLUE="\[\033[1;34m\]"
    local RED="\[\033[0;31m\]"
    local DARK_RED="\[\033[1;31m\]"
    local BLACK="\[\033[0;30m\]"
    local GREEN="\[\033[0;32m\]"
    local CYAN="\[\033[0;36m\]"
    local PURPLE="\[\033[0;35m\]"
    local BROWN="\[\033[0;33m\]"
    local NO_COLOR="\[\033[0m\]"
    case $TERM in
        xterm*|rxvt*)
            TITLEBAR='\[\033]0;\u@\h:\w\007\]'
            ;;
        *)
            TITLEBAR=''
            ;;
    esac
    #PS1="\u@\h [\t]\$ "
    #PS1="${TITLEBAR}$BLUE\u$NO_COLOR@$BLUE\h $BROWN\w\n$BLUE<>>$NO_COLOR($GREEN"'\$'"$NO_COLOR)$RED>$NO_COLOR "
    PS1="${TITLEBAR}$DARK_BLUE\u$NO_COLOR@$CYAN\h $BROWN\w\n$BLUE<>>$NO_COLOR($GREEN"'\$'"$NO_COLOR)$RED>$NO_COLOR "
    PS2='continue-> '
    PS4='$0.$LINENO+ '
}
prompt01
 
#BSD Aliases
alias ls='/bin/ls -Gha'
alias dir='/bin/ls -Ghal'
alias dirb='/bin/ls -Gal'
 
alias openports='sudo netstat -natl'
alias openports2='nmap -p 1-65535 --open localhost'
alias whatismyip='curl -s http://icanhazip.com/'
 
alias mv='time mv -v'
alias rm='time rm -v'
alias cp='time cp -v'
 
alias catl='/usr/bin/grep -n "^"'
alias lines='sed "/^/=" | sed "N;s/\n/. /"'
 
alias dus='du -s'
alias duh='du -sh'
alias dul='du -h -d 1'
 
alias df='df -h'
 
alias iostatall='iostat -c 3'
 
alias locate='locate -i'
 
alias grep='/usr/bin/grep -i --color=auto'
alias grep3='/usr/bin/grep -A3 -B3 -i --color=auto'
alias igrep='/usr/bin/grep -iv --color=auto'
alias egrep='/usr/bin/grep -iE --color=auto'
alias fgrep='/usr/bin/grep -iF --color=auto'
 
alias burn16='/usr/bin/cdrecord -v -dao speed=16'
alias burn24='/usr/bin/cdrecord -v -dao speed=24'
alias burn32='/usr/bin/cdrecord -v -dao speed=32'
alias burnerase='/usr/bin/cdrecord blank=fast'
 
alias mr.favcoms='mr.favcom|grep3'
 
alias rdesktop='rdesktop -g 1024x768 -z -x b -r clipboard:CLIPBOARD -r disk:root=/'
 
 

CSH C Shell
/home/user/.cshrc
Note if you use bash instead of cshell then you can use the same linux format above, note that freeBSD's ls command \
does not accept --color..., so you must remove that first

Code Snippet
#mReschke Prompt
if ($?prompt) then
        # An interactive shell -- set some stuff up
    set prompt = '%n@%m:%/% '
        set filec
        set history = 100
        set savehist = 100
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif
endif

#mReschke Aliases
alias ls        /bin/ls -hA
alias lsl       '/bin/ls -hA|less'
alias dir       /bin/ls -hAl
alias dirl      '/bin/ls -hAl|less'
alias dirk      /bin/ls -kAl
alias dirb      /bin/ls -Al
alias fw        /sbin/iptables -L --line-numbers
alias grep      grep -i --color=auto
alias rm        rm -rf
alias burn16    cdrecord -v -dao speed=16 dev=0,0,0
alias burn24    cdrecord -v -dao speed=24 dev=0,0,0
alias burn32    cdrecord -v -dao speed=32 dev=0,0,0

Mac OSX Configs[-][- -][++]

Also, make a /private/var/root/.bashrc and add source /etc/profile

/etc/profile

Code Snippet
#mReschke Prompt
if[ "$PS1" ]; then
    if [ "$BASH" ]; then
        PS1='\u@\h:\w\$ '
    else
        if [ "'id -u'" -eq 0 ]; then
            PS1='# '
        else
            PS1='$ '
        fi
    fi
fi

#mReschke Aliases
alias ls='ls -HaGF'
alias dir='ls -HlaGFh'
alias dirb='ls -HlaGF'
alias mv='time mv =fv'
alias rm='time rm -irv'
alias cp='time cp -vRpX'
alias dus='du -s'
alias duh='du -sh'
alias dul='du -hd1'
alias df='df -h'
alias iostat='iostat -c1000'
alias locate='locate -i'
alias grep='grep -i --color=always'
alias igrep='grep -iv --color=always'
alias sshnwq='ssh -p 12222 nwq@qserver'
alias sshqdesk='ssh -p 12223 ubuntu@qserver'
alias sshweb6='ssh -p 20022 administrator@216.253.88.135'
alias sshhserver='ssh -p 12222 hserver@mediaqons.com'
alias sshmedia='ssh media@media'
alias sshnetworq='ssh networqm@networqmedia.com'
alias sshzabbix='ssh -p 20022 monitor@zabbix.dornback.com'