-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_alias
123 lines (110 loc) · 3.34 KB
/
bash_alias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# vim: set filetype=sh :
# Expand aliases; needed to use below alises via Vim :sh / :!
shopt -s expand_aliases
# Basic, always-on aliases
# Sudo
alias svim='sudo vim'
alias stail="sudo tail"
alias svs="sudo supervisorctl"
# System
alias rm='rm -i'
alias src="cd ~/src"
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
alias h='history'
alias j='jobs -l'
alias which='type -all'
alias ..='cd ..'
alias path='echo -e ${PATH//:/\\n}'
alias du='du -kh'
alias dux='du -ksh ./* | sort -n'
alias df='df -kTh'
alias la='ls -Al' # show hidden files
alias lk='ls -lSr' # sort by size
alias lc='ls -lcr' # sort by change time
alias lu='ls -lur' # sort by access time
alias lr='ls -lR' # recursive ls
alias lt='ls -ltr' # sort by date
alias lm='ls -al |more' # pipe through 'more'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias excuse='echo `telnet bofh.jeffballard.us 666 2>/dev/null` |grep --color -o "Your excuse is:.*$"'
alias commic='wget http://dynamic.xkcd.com/comic/random/ -O -| grep <img src="http://imgs.xkcd.com/comics | sed s/<img src="// | sed s/"[a-z]*.*// | wget -i - -O -| display'
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
# Package managers
alias apt-get='sudo apt-get'
alias apt-cache='sudo apt-cache'
alias aptitude='sudo aptitude'
alias apt-file='sudo apt-file'
alias ash='aptitude show'
alias ai='aptitude install'
alias as='aptitude search'
alias au='aptitude update'
alias dl='dpkg --list'
alias port='sudo port'
alias emerge='sudo emerge'
# Misc
alias tree='tree -Ca -I ".git|*.pyc|*.swp"'
alias screen='TERM=screen screen'
alias rap="sudo /etc/init.d/apache2 reload"
alias ports="sudo lsof -i -P -sTCP:LISTEN"
alias ack='ack -a'
# Spelling typos
alias xs='cd'
alias vf='cd'
alias moer='more'
alias moew='more'
alias kk='ll'
# Functions
convert_hex_to_decimal()
{
echo $((0x$1))
}
dosum()
{
cksfv $1 | grep $1 | grep -v ";" | awk '{ print $2 }'
}
# process / system toys
function my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; }
function pp() { my_ps f | awk '!/awk/ && $0~var' var=${1:-".*"} ; }
function ii() # get current host related info
{
echo -e "\nYou are logged on ${RED}`hostname`"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Memory stats :$NC " ; free
echo
}
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
}
# Change the window title of X terminals
case $TERM in
xterm*|rxvt*|Eterm)
PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~}\007"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${PWD/$HOME/~}\033\\"'
;;
esac