Skip to content

Instantly share code, notes, and snippets.

@zhasm
Created February 29, 2012 06:11
Show Gist options
  • Save zhasm/1938404 to your computer and use it in GitHub Desktop.
Save zhasm/1938404 to your computer and use it in GitHub Desktop.
bash_aliases
#converting utilities
alias b2u='iconv -f big5 -t utf-8'
alias g2u='iconv -f gbk -t utf-8'
alias sec='date "+%s"'
alias now='date "+%Y-%m-%d %H:%M"'
#show image resolution
alias resolution='identify $1 |awk '\''{print $3}'\'''
#count freqency
alias count='sort | uniq -c| sort -nr'
#editor
alias e='emacsclient -t -a ""'
alias ea='e ~/.bash_aliases && . ~/.bash_profile && echo '\''Alieas updated!'\'''
alias ee='e ~/.bash_profile && . ~/.bash_profile && echo '\''Profile updated'\'''
alias ef='e ~/.bash_functions && . ~/.bash_profile && echo '\''Functions updated!'\'''
alias em='e ~/.emacs && echo '\''emacs profile updated'\'''
alias ev='e ~/.vimrc && echo '\''vimrc updated.'\'''
alias ss='. ~/.bash_profile && echo '\''Profile updated.'\'''
##network
alias flushdns='dscacheutil -flushcache'
#restart network
alias netr='sudo ifconfig eth0 down ; sleep 1; sudo ifconfig eth0 up'
#show current ip, including public ip
alias myip='ifconfig |grep -oP '\''(?<=inet addr:)[\d.]+'\'' |grep -v ^127 ;curl ifconfig.me && ifconfig | grep -oP "(?<=\binet )[.\d]+" '
#show network res
alias res='cat /etc/resolv.conf'
#start file server at current folder and show the LAN IP
alias sv='ifconfig |grep -oP "(?<=inet addr:)[0-9.]+" | grep -v 127.0.0.1 | sed "s/$/:8000/" && python -m SimpleHTTPServer &'
alias grep='grep --color=always -s -I '
alias host='sudo emacs -nw /etc/hosts'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
#for MacOS only
#lock the screen
alias lk='osascript -e '\''tell application "ScreenSaverEngine"'\'' -e activate -e '\''end tell'\'' 2&>/dev/null'
#growl notify command
alias notify='growlnotify -m'
alias routetable='netstat -rn'
#restart window server
alias rwindow='killall SystemUIServer'
alias top='top -o cpu'
alias top10='ps aux |head'
alias o='open'
alias phpgrep='find . -name '\''*.php'\'' |xargs grep'
alias pygrep='find . -name '\''*.py'\'' |xargs grep'
alias pi='sudo easy_install'
alias ping='ping -c 3'
#python, django
alias ipy='ipython'
alias py='python'
alias py3='python3'
alias pm='python manage.py'
alias pmr='python manage.py runserver 0.0.0.0:8000'
alias pms='python manage.py shell'
alias pmsyn='python manage.py syncdb'
alias psgheader='ps aux| head -1'
alias psg='psgheader ; ps aux| grep -v grep |grep -i'
#misc
alias star='/usr/bin/screen -d -r zhasm || /usr/bin/screen -S zhasm'
alias tree='find . -print | sed -e '\''s;[^/]*/;|____;g;s;____|; |;g'\'''
alias x='exit'
alias zmb='ps aux |awk '\''$8 ~ /Z/'\'''
alias df='df -h'
@zhasm
Copy link
Author

zhasm commented Feb 29, 2012

哦, 果然!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment