-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_aliases
50 lines (41 loc) · 1.01 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
# Make and change directory at once
unalias md 2>/dev/null
md () {
mkdir -p "$1" && cd "$1"
}
# cd into directory on git clone
git() {
local tmp=$(mktemp)
local repo_name
if [ "$1" = clone ] ; then
/usr/bin/git "$@" 2>&1 | tee $tmp
repo_name=$(awk -F\' '/Cloning into/ {print $2}' $tmp)
rm $tmp
printf "changing to directory %s\n" "$repo_name"
cd "$repo_name"
else
/usr/bin/git "$@"
fi
}
function pushtmp() {
tmp_dir=$(mktemp -d -t GAR-$(date +%Y-%m-%d-%H-%M-%S)-XXXX)
pushd "$tmp_dir"
}
alias py=python3
alias python=python3
alias pip=pip3
# Change directories easily
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
alias dwn='pushd ~/storage/downloads'
alias root='pushd ~'
# Stop ctrl+s from freezing your terminal
stty stop ''
# Enable windows-style completion
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi