-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
254 lines (213 loc) · 5.66 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#
# ~/.bashrc
#
. ~/.git-prompt.bash
precmd() {
echo `git_prompt_precmd`
}
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export HISTCONTROL=ignoreboth:erasedups
SELECT(){
if [ "$?" -eq 0 ]
then
echo ""
else
echo "[X]"
fi
}
COLOR_BLACK="\[$(tput setaf 0)\]"
COLOR_RED="\[$(tput setaf 1)\]"
COLOR_GREEN="\[$(tput setaf 2)\]"
COLOR_YELLOW="\[$(tput setaf 3)\]"
COLOR_BLUE="\[$(tput setaf 4)\]"
COLOR_PURPLE="\[$(tput setaf 5)\]"
COLOR_CYAN="\[$(tput setaf 6)\]"
COLOR_WHITE="\[$(tput setaf 7)\]"
COLOR_BOLD="\[$(tput bold)\]"
COLOR_RESET="\[$(tput sgr0)\]"
#PS1="${COLOR_RED}\$(SELECT)${COLOR_CYAN}[${COLOR_RESET}\\w${COLOR_CYAN}]-[${COLOR_RESET}\\@${COLOR_CYAN}]${COLOR_PURPLE}\$(precmd)
PS1="${COLOR_RED}\$(SELECT)${COLOR_GREEN}\\w ${COLOR_YELLOW}\$(precmd)
${COLOR_GREEN}${COLOR_BOLD}::${COLOR_RESET} "
mkcd() {
if [ $# != 1 ]; then
echo "Usage: mkcd <dir>"
else
mkdir -p $1 && cd $1
fi
}
cdls() {
cd "$@" && l;
}
rd(){
pwd > "$HOME/.lastdir_$1"
}
crd(){
lastdir="$(cat "$HOME/.lastdir_$1")">/dev/null 2>&1
if [ -d "$lastdir" ]; then
cd "$lastdir"
else
echo "no existing directory stored in buffer $1">&2
fi
}
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
}
youtube() {
if [ $# -eq 1 ]
then
youtube-dl -q "$1"
elif [ $# -eq 2 ]
then
youtube-dl -q -x --audio-format mp3 "$2"
else
echo "No arguments supplied"
fi
}
deps() {
if [[ "$1" -eq "p" ]]
then
sudo pacman -Si "$2" |sed -n '/Depends\ On/,/:/p'|sed '$d'|cut -d: -f2
elif [[ "$1" -eq "y" ]]
then
yay -Si "$2" |sed -n '/Depends\ On/,/:/p'|sed '$d'|cut -d: -f2
fi
}
gitclone() {
if [[ "$1" -eq "gh" ]]
then
git clone https://BradHeff:TOKEN@github.com/BradHeff/"$2".git
elif [[ "$1" -eq "gl" ]]
then
git clone https://BradHeff:TOKEN@gitlab.com/BradHeff/"$2".git
fi
}
gitremote() {
if [[ "$1" -eq "gh" ]]
then
git remote add origin https://BradHeff:TOKEN@github.com/BradHeff/"$2".git
elif [[ "$1" -eq "gl" ]]
then
git remote add origin https://BradHeff:TOKEN@gitlab.com/BradHeff/"$2".git
fi
}
dd() {
if [ $# -eq 2 ]; then
sudo dd status=progress if="$1" of="$2"
else
echo "Must take only 2 arguments"
echo "EXAMPLE:"
echo "dd /path/iso /dev/sd?"
fi
}
if [ -d "$HOME/.bin" ];
then
PATH="$HOME/.bin:$PATH"
fi
#list
alias ls='ls --color=auto'
alias la='ls -a'
alias ll='ls -la'
alias l='ls'
alias l.="ls -A | egrep '^\.'"
alias vtop='vtop -t wizard'
#fix obvious typo's
alias cd..="cd .."
alias pdw="pwd"
## Colorize the grep command output for ease of use (good for log files)##
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
#readable output
alias df='df -h'
#pacman unlock
alias unlock="sudo rm /var/lib/pacman/db.lck"
#free
alias free="free -mt"
#continue download
alias wget="wget -c"
#userlist
alias userlist="cut -d: -f1 /etc/passwd"
#merge new settings
alias merge="xrdb -merge ~/.Xresources"
# Aliases for software managment
# pacman or pm
alias pacman="sudo pacman --color auto"
alias update="sudo pacman -Syyu"
alias pins="sudo pacman -S --color auto"
alias psr="sudo pacman -Ss --color auto"
alias pdep="deps p"
# yay as aur helper - updates everything
alias pksyua="yay -Syu --noconfirm"
alias yins="yay -S --color auto"
alias ysr="yay -Ss --color auto"
alias ydep="deps y"
#ps
alias ps="ps auxf"
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
#grub update
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
#improve png
alias fixpng="find . -type f -name "*.png" -exec convert {} -strip {} \;"
#add new fonts
alias fc="sudo fc-cache -fv"
#get fastest mirrors in your neighborhood
alias mirror="sudo reflector --protocol https --latest 50 --number 20 --sort rate --save /etc/pacman.d/mirrorlist"
alias mirrors=mirror
#mounting the folder Public for exchange between host and guest on virtualbox
alias vbm="sudo mount -t vboxsf -o rw,uid=1000,gid=1000 Public /home/$USER/Public"
alias gpl="git pull"
alias gcl="git clone"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push -u origin master"
alias gr="git rm"
alias grd="git rm -r"
alias gra="gitremote"
alias gcln="gitclone"
alias serv="ssh brad@192.168.1.5"
alias dd="dd"
alias sZ="source ~/.bashrc"
alias eZ="vim ~/.bashrc"
alias e3="vim ~/.config/i3/config"
alias ~="cd ~ && source ~/.bashrc"
alias yt='youtube'
alias ytm='youtube mp3'
alias rmd='rm -r'
alias srm='sudo rm'
alias srmd='sudo rm -r'
alias cpd='cp -R'
alias scp='sudo cp'
alias scpd='sudo cp -R'
alias slin='sudo ln -s'
alias lin='ln -s'
#shopt
shopt -s autocd # change to named directory
shopt -s cdspell # autocorrects cd misspellings
shopt -s cmdhist # save multi-line commands in history as single line
shopt -s dotglob
shopt -s histappend # do not overwrite history
shopt -s expand_aliases # expand aliases
#neofetch
#clear && cowsay 'Welcome to ArcoLinuxD'
export _JAVA_AWT_WM_NONREPARENTING=1
#clear && ~/.2bwm/info
clear && bash ~/.2bwm/flowerfetch
EDITOR=vim