Skip to content

Instantly share code, notes, and snippets.

@bastos
Created November 11, 2008 20:31
Show Gist options
  • Save bastos/23961 to your computer and use it in GitHub Desktop.
Save bastos/23961 to your computer and use it in GitHub Desktop.
my .bashrc with lots of dotfiles.org stuff :D
# If not running interactively, don't do anything
# [ -z "$PS1" ] && return
export EDITOR=emacsclient
export IOKE_HOME=~/code/ioke
# 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 a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
force_colored_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
unset color_prompt force_color_prompt
# 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
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias iso2utf='iconv -f iso-8859-1 -t utf-8'
alias utf2iso='iconv -f utf-8 -t iso-8859-1'
alias config-data='sudo ntpdate -u -b ntp.usp.br' # ajusta data pela rede
# list 10 biggest files in current path
alias big_files="BLOCKSIZE=1048576; du -x | sort -nr | head -10"
alias ..="cd .."
alias ...="cd ../.."
alias gemi='sudo gem install --no-rdoc --no-ri'
alias e='emacs'
alias ec='emacsclient'
if [ -f /etc/bash_completion.d/git ]; then
. /etc/bash_completion.d/git
fi
reload()
{
source ~/.bashrc
}
shot ()
{
import -w root -quality 75 "$HOME/shot-$(date +%s).png"
}
# compressed file excractor
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar 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 "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
bz2 () {
tar cvpjf $1.tar.bz2 $1
}
# Services
rcstart()
{
for arg in $*
do
sudo /etc/rc.d/$arg start
done
}
rcstop()
{
for arg in $*
do
sudo /etc/rc.d/$arg stop
done
}
rcrestart()
{
for arg in $*
do
sudo /etc/rc.d/$arg restart
done
}
rcreload()
{
for arg in $*
do
sudo /etc/rc.d/$arg reload
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment