-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliases
executable file
·163 lines (123 loc) · 4.94 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
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
#
# Pls note that special formatting is required for the comments to be displayed correctly in the listAliases command
# You can create a Title like this:
# ###################
# ## Example Title ##
# ###################
#
# And a Description for an alias is a comment that starts with a single hash and space "# " one line above the alias.
# Command options can be added to the Description with "Options: " followed by the options starting with a hyphen.
# Example:
# # Example Alias Description Options: -v will apear as option and option description -h this is another option
# alias example='YOUR_COMMAND'
#
################
## Kubernetes ##
################
# kubectl command shortcut that will use kubectl if available, otherwise it will use microk8s kubectl
alias k='kubeTarget'
# kubectl will use kubectl if available, otherwise it will use microk8s kubectl
alias kubectl='kubeTarget'
# shortcut to get rollout restart
alias kpf="kubectl port-forward"
# shortcut to get all pods in all namespaces
alias kls='kubeTarget get pods --all-namespaces'
# shortcut to get all services in all namespaces
alias ksv='kubeTarget get services --all-namespaces'
# shortcut to get all deployments in all namespaces
alias kdp='kubeTarget get deployments --all-namespaces'
# shortcut to get all nodes
alias kn='kubeTarget get nodes'
# shortcut to get all namespaces
alias kns='kubeTarget get namespaces'
# shortcut to get rollout history
alias kdh='kubeTarget rollout history'
# shortcut to get rollout status
alias kds='kubeTarget rollout status'
##############
## MicroK8s ##
##############
# Starting MicroK8s
alias m8='microk8s'
# Accessing the MicroK8s dashboard proxy
alias m8dp='microk8s dashboard-proxy'
# Install MicroK8s by running the install script
alias install_microk8='sh ~/.Musalias/install_MicroK8s.sh'
############
## Docker ##
############
# shortcut for docker-compose or docker compose
alias dc='docker_compose'
# shortcut for docker-compose or docker compose logs -f -n 500
alias dcl='docker_compose logs -f -n 500'
# will pull, down and up as deamon a docker compose, will remove orphans, and follow logs after up
recomp() {
docker_compose pull
docker_compose down
docker_compose up --remove-orphans -d
docker_compose logs -f
}
# will pull, build, down and up as deamon a docker compose, will remove orphans, and follow logs after up
recompBuild() {
docker_compose pull
docker_compose build
docker_compose down
docker_compose up --remove-orphans -d
docker_compose logs -f
}
################
## Filesystem ##
################
# Listing all files with human-readable sizes
alias lh='ls -lah'
# Display the size of all folders in the current directory, sorted by size
alias dud='du -hd 1 . | sort -hr'
# Display all file contents in the current directory recursively and write to showContentsOutput.txt Options: -c Clean content by removing excessive whitespace and line breaks -e Comma-separated list of glob patterns to exclude (overrides default excludes)
alias showContents='~/.Musalias/show_contents.sh'
# Function to tar and compress a directory with ZSTD, $0 <directory> is required
tazstd() {
if [ -z "$1" ]; then
echo "Usage: tazstd <directory>"
return 1
fi
tar -cf - "$1" | zstd -o "$1.tar.zst"
}
# Function to create directories recursively and navigate to the deepest directory, $0 <directory> is required
mkdid() {
if [ -z "$1" ]; then
echo "Usage: mkdid <directory_path>"
return 1
fi
mkdir -p "$1" && cd "$1" || return
}
###########################
## System Administration ##
###########################
# Update, upgrade, dis-upgrade, and autoremove packages 👑
alias up='sudo apt-get update && sudo apt-get -y full-upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove'
# Install default packages: docker.io, docker-compose-v2, htop, iftop, fzf 👑
alias install_default='sudo apt install -y docker.io docker-compose-v2 htop iftop fzf'
###################################
## Aliases (this script) Related ##
###################################
# Alias for listAliases script
alias laa='listAliases'
# Alias for listAliases script
alias aliasesList='listAliases'
# List all available aliases and functions with their descriptions in fzf with fallback to less Options: -v will show the aliases file not interactive -m will print in markdown format not interactive
listAliases() {
if [[ "$1" == "-v" || "$1" == "-m" ]]; then
bash ~/.Musalias/listAliases.sh "$1"
else
if command -v fzf &>/dev/null; then
bash ~/.Musalias/listAliases.sh | fzf --ansi --tac
else
bash ~/.Musalias/listAliases.sh | less -R
fi
fi
}
# Update the aliases collection on your system
alias aliasup='( cd ~/.Musalias && git pull ) && source ~/.Musalias/aliases'
# replace the Aliases section in ~/.Musalias/README.md with the current listAliases -m output
alias musaliasUpdateReadme='sh ~/.Musalias/update_readme.sh'
source $HOME/.Musalias/helper