-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_aliases
75 lines (61 loc) · 1.76 KB
/
bash_aliases
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
#!/bin/bash
#########################
# system dependent part #
#########################
init_linux_conf() {
# add sbin for default ubuntu setting
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
# term set
if [ "$COLORTERM" == "gnome-terminal" ] || [ "$COLORTERM" == "xfce4-terminal" ] ||
[ "$TERM" == "xterm" ]
then
TERM=xterm-256color
elif [ "$COLORTERM" == "rxvt-xpm" ]
then
TERM=rxvt-256color
fi
alias sysupdate='sudo apt-get update && sudo apt-get dselect-upgrade -y && sudo apt-get clean'
alias open='xdg-open'
alias chrome_hidpi='chromium-browser --force-device-scale-factor=2'
# add export
export EDITOR=vi
export MAKEFLAGS=-j5
}
init_darwin_conf() {
# path
export PATH=/usr/local/bin:$PATH
# cmd prompt
export PS1="\u@\h:\w\$ "
# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS="ExGxBxDxCxEgEdxbxgacxd"
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
# add bash completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# java dir path
export JAVA_HOME=$(/usr/libexec/java_home)
alias ls='ls -Fh'
alias ll='ls -l'
}
if [ "$(uname)" == "Darwin" ]; then
init_darwin_conf
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
init_linux_conf
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
echo "Cygwin"
fi
###############
# common part #
################
alias df='df -h'
alias du='du -h'
# add useful aliases
alias h='history 100'
alias g='grep'
alias r='reset'
alias tmnew='tmux new-session -s $USER'
alias tmat='tmux attach || tnew'
alias tmls='tmux list-sessions'