20090504

More tweaking of my .bashrc when I should be getting other work done.

I think it's a kind of procrastination, but I've tweaked several things, like using pushd instead of cd and a way to list the bookmarks. Maybe this is useful to someone besides myself.

#-----------------------------------------------------------------------------
# file management and navigation

alias g="pushd"
alias b="popd"
alias gr="pushd /"
alias gm="pushd /media/disk1part3/renick/music/"
alias l='ls -a --group-directories-first | less -rn'
alias ls='ls -CF'
alias ll='ls -lahGp --color=always --group-directories-first | less -rn'
alias llt='ls -lahGpt --color=always --group-directories-first | less -rn'
alias lsd="ls -d */"
alias duh='du -h --max-depth=1 | less'
alias dus='du | sort -nr | less'
alias ..='pushd ..'
alias ...='pushd .. ; pushd ..'

# system for making quick bookmarks
alias +1='echo ~+ > ~/.path1'
alias +2='echo ~+ > ~/.path2'
alias +3='echo ~+ > ~/.path3'
alias +4='echo ~+ > ~/.path4'
alias +5='echo ~+ > ~/.path5'
alias +6='echo ~+ > ~/.path6'
alias +7='echo ~+ > ~/.path7'
alias +8='echo ~+ > ~/.path8'
alias +9='echo ~+ > ~/.path9'
alias +0='echo ~+ > ~/.path0'
# list the bookmarks
alias lb='for i in '~/.path*'; do echo -e "\E[37;44m""$i";cat $i; done; tput sgr0'
# go to the numbered bookmark
j () { pushd "$(cat ~/.path$1)"; }

alias yp='echo ~+ > ~/.yankedpath'
alias pp='cat ~/.yankedpath'

alias G='pushd `pp`'

# extract any archive
xx () {
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
}

No comments: