-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell_profile
85 lines (71 loc) · 2.2 KB
/
shell_profile
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
# A shell profile file
#
# Author: XJP09_HK <jianping_xie@aliyun.com>
# Last change: 2017-06-20
#
# Usage:
# edit your private shell profile(.bashrc, .zshrc etc), then insert 'source ${THIS_FILE}'
# Include autojump
[[ -z "$AUTOJUMP_PREFIX" ]] && AUTOJUMP_PREFIX=${HOME}/.autojump
[[ -f $AUTOJUMP_PREFIX/etc/profile.d/autojump.sh ]] && . $AUTOJUMP_PREFIX/etc/profile.d/autojump.sh
# Common alias
alias cat='cat -entv'
alias mkcdir='_f() { mkdir "$1" && cd "$1" }; _f'
alias curlf='curl -OL'
alias df='df -h'
alias dates='date +"%Y-%m-%d %H:%M:%S"'
alias grep='grep -i --color'
alias ll='ls -lhsiF --color=auto'
alias lla='ll -a'
alias ln='ln -sv'
alias mv='mv -iv'
alias rm="echo -e \"This command is forbidden!!!\nYou can try 'delete'.\""
alias delete='\rm -riv'
alias deletef='delete -f'
alias targz='tar -xzvf'
alias tarbz='tar -xjvf'
alias vimode='set -o vi'
alias emacsmode='set -o emacs'
#alias dstat='dstat -cdlmnpsy'
# Process alias
alias psf='ps aux | grep'
alias psfr='ps aux| grep " R" | grep -v grep'
alias wr='watch "ps aux| grep \" R\" | grep -v grep"'
# Network alias
alias ips="ifconfig | grep 'inet ' | awk '{print \$2}'"
alias ping='ping -c 10'
alias netstatl='sudo netstat -ntpl | grep -i listen'
# Docker alias
alias di='sudo docker images'
alias dl='sudo docker logs'
alias dr='sudo docker run'
alias dri='sudo docker run --rm -it'
alias de='sudo docker exec -it'
alias dp='sudo docker ps'
alias dpf="sudo docker ps --format 'table{{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}'"
# Gentoo alias
alias em='sudo emerge'
# Linux -> Mac command transfer
if [ `uname -s` = 'Darwin' ] ;then
alias ll='ls -lhsiFG'
alias delete='_f() { mv "$@" ~/.Trash }; _f'
alias ldd='otool'
alias updatedb='sudo /usr/libexec/locate.updatedb'
alias strace='sudo dtruss'
alias netstatl='netstat -an -p tcp | grep -i listen'
fi
# History config
export HISTFILESIZE=100000
export HISTSIZE=100000
export HISTTIMEFORMAT=`whoami`" : %Y %h/%d - %H:%M:%S "
# Man with color
man() {
env LESS_TERMCAP_mb=$'\E[01;3m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}