Articles/Best ShellScript Alias
From LUG@IITD
Here we are trying to list out best of shell scripts which you love , Please add your shell scripts so that Other can get benefits. From http://www.shell-fu.org/lister.php?top and http://www.commandlinefu.com/ Please Edit this file and add your tricks SchoolOS contains modified bashrc which include these tricks
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
export PS1="\n [\w]\n\$"
alias editbashrc="nano ~/.bashrc"
alias updatebashrc="source ~/.bashrc"
alias refreshpackagelist="sudo aptitude update"
alias install="sudo aptitude install"
alias remove="sudo aptitude remove"
alias free="free -m"
alias ll="ls -lha"
alias home='cd ~ && clear'
alias ls='ls --color=auto'
alias shutdown='sudo shutdown -h now'
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias copy='cp -f'
alias home='cd ~/'
alias df="df -h"
alias du='du -h -c'
alias externalip='wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1'
alias nano="nano -w" #Disable annoying line wrappingd
alias reboot='sudo reboot'
alias sittingtime='uptime'
alias list-installed-packages="dpkg --get-selections | sed -ne 's/\t\t*install$//p'"
# Extract archives
extract () {
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
}
define() {
local LNG=$(echo $LANG | cut -d '_' -f 1)
local CHARSET=$(echo $LANG | cut -d '.' -f 2)
lynx -accept_all_cookies -dump -hiddenlinks=ignore -nonumbers -assume_charset="$CHARSET" -display_charset="$CHARSET" "http://www.google.com/search?hl=${LNG}&q=define%3A+${1}&btnG=Google+Search" | grep -m 5 -C 2 -A 5 -w "*" > /tmp/deleteme
if [ ! -s /tmp/deleteme ]; then
echo "Sorry, google doesn't know this one..."
else
cat /tmp/deleteme | grep -v Search
echo ""
fi
rm -f /tmp/deleteme
}
* [http://www.casino-spielen.biz casino deutschland]
function mcd() { [ -n "$1" ] && mkdir -p "$@" && cd "$1"; }