-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
89 lines (69 loc) · 2.45 KB
/
.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
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
# Alias para Grep e LS (cor)
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Alias para listagem de arquivos e diretórios
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias remove-empty-folders="find $pwd -type d -empty -delete"
alias remove-duplicate-files="find $pwd -type f -print0 | xargs -0 md5sum | sort -r | uniq -dD -w32 | awk '{ print \$2 }' | while read -r file; do rm \$file; done"
# Alias para pular diretórios
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias ~~="cd ~"
alias v5="cd /var/www/html/v5"
# Alias para capturar o IP
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
# Alias diff (comparação)
command -v diff > /dev/null || alias diff="git diff --no-index"
# Taskbook
function __taskbook_alias() {
cmd="$1"
args=${@:2}
eval "taskbook --$cmd $args"
}
alias tb="__taskbook_alias"
# Finaliza todos os containers do Docker
alias docker-stop-all='docker stop $(docker ps --format "{{.ID}}")'
# Reset Docker
function __docker_reset_all() {
echo "Esta ação removerá todos os containers, imagens e volumes.";
echo "Deseja continuar? (y/N)";
read answer
if [[ $answer = "Y" ]]; then
echo "Removendo...";
docker container rm $(docker ps -a --format "{{.ID}}")
docker image rm $(docker image ls -a --format "{{.ID}}")
docker network rm $(docker network ls --format "{{.ID}} {{.Name}}" | grep -vE "bridge|host|none" | cut -d" " -f1)
else
echo "Ação cancelada";
fi
}
alias docker-reset='docker_reset_all'
# Executa PHP Interactive Shell
function __start_php_commandline() {
php_version=$(docker images --filter=reference="php:8*" --format "{{.ID}}" | head -n 1)
if [[ -z $php_version ]]; then
php_version=$(docker images --filter=reference="php:7*" --format "{{.ID}}" | head -n 1)
fi
if [ -z "$versions" ]; then
php_version="php:latest"
fi
echo $php_version;
}
alias php-cli='docker run -it --network host $(__start_php_commandline) php $@'
# Executa Node Interactive Shell
function __start_node_commandline() {
node_version=$(docker image ls node --format "{{.ID}}" | head -n 1)
if [ -z "$node_version" ]; then
node_version="node:latest"
fi
echo $node_version;
}
alias node-cli='docker run -it $(__start_node_commandline) node'