What's in your /home/.bashrc

Here you can discuss every aspect of Debian. Note: not for support requests!

What's in your /home/.bashrc

Postby craigevil » 2010-07-02 07:04

Keeping in the spirit of "Whats in your inputrc and other similar threads"

$cat .bashrc
alias ls='ls --color=auto'

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
### Added by surfraw. To remove use surfraw-update-path -remove
export PATH=$PATH:/usr/lib/surfraw
### End surfraw addition.


The surfraw part allows you to type google foo or any other elvi without having to type sr or surfraw first.
Debian Sid KDE 4.8 Kernel 3.7 Thinkpad R40 Intel M 1.3 CPU 2GB RAM Radeon Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Giant Debian sources.list | Debian upgrade script smxi | sysinfo script inxi
User avatar
craigevil
 
Posts: 5149
Joined: 2006-09-17 03:17
Location: down the rabbit hole

Re: What's in your /home/.bashrc

Postby traveler » 2010-07-02 07:12

Found this some time ago. I always paste it at the end of /root/.bashrc so the root prompt is a distinct color (red here) instead of the standard green in my home .bashrc
Not rocket science, but it makes me think before executing commands as root.
Code: Select all
TERM_USER_HOST_COLOR='0;31m'
TERM_PATH_COLOR='0;31m'
TERM_PROMPT_COLOR='m'


TERM_USER_HOST='\u@\h'
TERM_PATH='\w'
TERM_PROMPT='\$'


export PS1=\
'\[\e['${TERM_USER_HOST_COLOR}'\]'${TERM_USER_HOST}'\[\e[m\]'\
' \[\e['${TERM_PATH_COLOR}'\]'${TERM_PATH}'\[\e[m\]'\
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)
User avatar
traveler
 
Posts: 942
Joined: 2010-06-09 22:07

Re: What's in your /home/.bashrc

Postby Telemachus » 2010-07-02 12:40

I was just editing mine yesterday. It's a (permanent) work in progress:

Code: Select all
# Base $HOME/.bashrc file

## A few global settings
# + check the window size after each command and, if necessary,
#   update the values of LINES and COLUMNS.
# + learn the damn Emacs bindings at least a little
shopt -s checkwinsize
set -o emacs

## Includes
if [ -f $HOME/.bash_aliases ]; then
  source $HOME/.bash_aliases
fi

if [ -f $HOME/.bash_functions ]; then
  source $HOME/.bash_functions
fi

if [ -f $HOME/.bash_path ]; then
  source $HOME/.bash_path
fi

if [ -f $HOME/.git-completion.sh ]; then
    source $HOME/.git-completion.sh
fi

## History settings
# + bigger is better
# + no dups; no lines starting with a space
# + handle multiple sessions sanely
# + save multi-line commands as a single line
# + :...; turns the timestamp into a "do-nothing" command
export HISTSIZE=1000
export HISTCONTROL=ignoreboth
shopt -s histappend cmdhist
export HISTTIMEFORMAT=': %Y-%m-%d %I:%M:%S; '

## Editor settings
export SVN_EDITOR=vim
export EDITOR=vim

## TODO: FIXME
# + Use CDPATH to make life better
export CDPATH=.:$HOME:$HOME/projects

## Ruby varia
# + source rvm
# + use rvm defaults by directory
# + jeweler defaults
if [ -s $HOME/.rvm/scripts/rvm ]; then
    source $HOME/.rvm/scripts/rvm
fi
rvm_project_rvmrc_default=1
export JEWELER_OPTS="--minitest --gemcutter --yard"

## Perl varia
# + put perlbrew where I want it and source it
# + defaults for cpanminus
# + a gross and utter hack to get my vim status line correct
export PERLBREW_ROOT=$HOME/.perl5/perlbrew
if [ -f $HOME/.perl5/perlbrew/etc/bashrc ]; then
    source $HOME/.perl5/perlbrew/etc/bashrc
fi
export PERL_CPANM_OPT="--mirror file:///$HOME/.minicpan\
    --mirror http://cpan.cpantesters.org"
export perlv='perl -e "print $^V"'


## TODO: FIXME
# color prompt
#PS1='\[\e[01;31m\]\u \W\[\e[00m\]\[\e[0;33m\]$(__git_ps1 " (%s)")\[\e[00m\] \[\e[01;31m\]\$ \[\e[00m\]'
red='\[\e[00;31m\]'
yellow='\[\e[00;33m\]'
end='\[\e[m\]'
gps='$(__git_ps1 " (%s)")'
PS1="${red}\u \W${end}${yellow}${gps}${end} ${red}\$${end} " 


# If this is an xterm set the title to "[ user dir ]"
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;[ ${USER} ${PWD} ]\007"'
    ;;
*)
    ;;
esac

## Pager stuff
LESS='-GRJx4P?f[%f]:[STDIN].?pB - [%pB\%]:\.\.\..'
export LESS
LESSOPEN="|/usr/local/bin/lesspipe.sh %s"
export LESSOPEN


Here's the aliases (I haven't started cleaning this up yet):

Code: Select all
# enable color support of ls and also add handy aliases
if [[ "$TERM" != "dumb" ]]; then
    alias ls='ls --color=auto'
    alias dir='ls --format=vertical'
    alias vdir='ls --format=long'
fi

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias lf='ls -CF'
alias l.='ls -d .[^.]*'
alias l.f='l. -F'
alias ll.='l. -l'

# aliases for safety
alias rmi='rm -i'
alias cpi='cp -i'
alias mvi='mv -i'

# aliases for clarity
alias cpv='cp -v'
alias rmv='rm -v'
alias mvv='mv -v'

# two cd aliases
alias ..='cd ..'
alias ...='cd ../../'

# alias to add or edit aliases
alias realias='vim ~/.bash_aliases;source ~/.bash_aliases'

# alias to add or edit functions
alias refunction='vim ~/.bash_functions;source ~/.bash_functions'

# a few git aliases
alias gs='git status'
alias gf='git fetch'
alias gpl='git pull'
alias gps='git push'
alias sched='ruby $HOME/bin/schedule.rb'
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
User avatar
Telemachus
 
Posts: 4676
Joined: 2006-12-25 15:53

Re: What's in your /home/.bashrc

Postby tomt » 2010-07-02 22:21

I have a couple 'borrowed' from other sources:

# create a Terminal Calculator
function calc()
{
echo "${1}"|bc -l;
}

and

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


Regards.
tomt
 
Posts: 51
Joined: 2005-09-09 20:19

Re: What's in your /home/.bashrc

Postby sir fer » 2010-07-03 03:38

Nice!

I just have:

Code: Select all
alias x='startx /usr/bin/startxfce4'
alias xo='startx /usr/bin/openbox-session'
alias xf='startx /usr/bin/startfluxbox'


in addition to the default gubbery.
sir fer
 
Posts: 923
Joined: 2008-09-10 18:49
Location: Auckland


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 25 guests

fashionable