forked from xchintan/ubuntu-dev-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc_public
100 lines (89 loc) · 2.2 KB
/
bashrc_public
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
# Works mostly for Konsole
# -------- Section:1 Let's set terminal prompt --------
# 1.1 Set colors
RESET="\[\017\]"
NORMAL="\[\033[0m\]"
RED="\[\033[31;1m\]"
YELLOW="\[\033[33;1m\]"
WHITE="\[\033[37;1m\]"
UCOLOR="\[\033[33m\]"
BLACK="\[\033[0m\]"
GREEN="\[\[\033[32m\]"
PINK="\[\033[m\]\[\[\033[35m\]"
# 1.2 Set Smiley/ Frowny
SMILEY="${GREEN} :)"
FROWNY="${RED} :("
SELECT="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\"; fi"
#1.3 Set Terminal Prompt
PS1="[${UCOLOR}\u${NORMAL}@${GREEN}\h ${PINK}\W\`${SELECT}\`${NORMAL}]\$"
# ------- Section 2 Set basic alias --------
alias ls='ls --color'
alias rm='rm -i'
alias ls='ls --color'
alias ll='ls -ltr'
alias vi='/usr/bin/vim'
alias startvnc='echo "vncserver -geometry 1280x720"'
alias bc='bc -l'
alias xterm="xterm -geometry 80x24+0+0 -fg black -bg grey"
# Define work/project specific aliases here
if [ -f ~/.alias.sh ]; then
source ~/.alias.sh
fi
# Define your aliases very specific to your development setup / your workstyle
alias code='source ~/.code.sh $@'
# Did you learn something new today? Put it in ~/.tips.sh
tips() {
if [ -f ~/tips.sh ]; then
./tips.sh
else
echo "No tips"
fi
}
# Some cool, alias
alias foldesize="du -S | sort -n -r |more"
up(){
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
cd $d
}
#Extract
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 "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
xplore()
{
find . -name *.c -o -name *.h > cscope.files
cscope -R -b -i cscope.files
}
cplink()
{
file=$1
tmp=`mktemp`
cp -Lv $file $tmp
mv -v $tmp $file
}