-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
158 lines (121 loc) · 3.53 KB
/
.bashrc
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
################
#### Divers ####
################
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
################
#### Prompt ####
################
#256 colors term
export TERM=xterm-256color
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
if [[ ${EUID} == 0 ]] ; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]${STATUS} \t> '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]${STATUS} \t> '
fi
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
# bash-git-prompt
if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
source ~/.bash-git-prompt/gitprompt.sh
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_THEME=Custom
fi
#################
#### Couleur ####
#################
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
fi
###############
#### Alias ####
###############
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias vi='vim'
alias svi='sudo vim'
alias svna='svn add'
alias svnm='svn mv'
alias svnd='svn del'
alias svnr='svn rm'
alias svni='svn info'
alias svns='svn status'
alias svnc='svn commit'
alias svndi='svn diff'
alias gita='git add'
alias gitci='git commit'
alias gitcl='git clone'
alias gitco='git checkout'
alias gits='git status'
alias gitb='git branch'
alias gitl='git log --color --graph --pretty=format:"%C(red)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
alias api='sudo apt install'
alias apupd='sudo apt update'
alias apupg='sudo apt upgrade'
alias apse='sudo apt search'
alias apsh='sudo apt show'
alias app='sudo apt purge'
alias apar='sudo apt-get autoremove'
alias apri='sudo aptitude reinstall'
alias service='sudo service'
alias avent='startct'
###################
#### Fonctions ####
###################
# Infos sur la session courante
function info()
{
echo -e " You are logged on $HOSTNAME"
echo -e " Additionnal information: " ; uname -a
echo -e " Users logged on: " ; w -h
echo -e " Current date : " ; date
echo -e " Machine stats : " ; uptime
echo -e " Memory stats : " ; free
echo ""
}
# Kill d'un processus
killd () {
DISPLAY="" ps xae | grep DISPLAY=:$1 | grep -v grep | awk '{print $1}' | xargs kill -9
}
####################
#### Completion ####
####################
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# hosts
complete -A hostname rsh telnet rlogin ssh ping nmap ftp
# sudo
complete -cf sudo
# cd
bind "set completion-ignore-case on"
bind "set show-all-if-ambigous on"