-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash-aliases-functions
50 lines (38 loc) · 955 Bytes
/
bash-aliases-functions
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
## bash Functions
## Virtualbox
startvm() {
VBoxManage startvm '$1' --type=headless
}
stopvm() {
VBoxManage controlvm '$1' savestate
}
## Docker
## docker build
db() { docker build --rm -t="$1" .; }
## enter into container
function dent {
docker exec -i -t $1 /bin/bash
}
complete -F _docker_exec dent
# run bash for any image
function dbash {
docker run --rm -i -t -e TERM=xterm --entrypoint /bin/bash $1
}
complete -F _docker_images dbash
## check container network
#function docknet() { docker inspect $1 -f '{{json .NetworkSettings.Networks }}' }
## Functions
function cheat() { curl cheat.sh/$1; }
function rhost() {
for i in `host $1|grep "has address"|awk '{print $4}'`
do
host $i|grep pointer|awk '{print "'$i'\t"$5}'
done
}
function dusort() {
du -s $1/* | sort -n | cut -f 2- | while read a; do du -sh "$a" ; done
}
function del-ssh() {
sed -i -e $1d ~/.ssh/known_hosts
}
## End