-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.bash_aliases
More file actions
316 lines (236 loc) · 8.03 KB
/
.bash_aliases
File metadata and controls
316 lines (236 loc) · 8.03 KB
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
### ALIASES ###
# Jump back to the root directory
alias root='cd /'
# Directory Navigation
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
# Go to the home directory.
alias ~='cd ~'
# Go to the previous directory.
alias -- -='cd -'
# List Directory Contents
# List with colorized output.
alias ls='ls -a -1'
# Long listing format with hidden files.
alias ll='ls -lah'
# List all items, including hidden files but excluding . and ..
alias la='ls -A'
# Show hidden files only.
alias l.='ls -d .* --color=auto'
# Windows-like experience
alias copy='cp'
alias rename='mv'
alias md='mkdir'
alias rd='rmdir'
alias del='rm -rf'
# Usual Commands
alias p='pwd'
alias r='reset'
alias c='clear'
alias h='history'
alias hh='history | grep -hi $1'
alias t='touch'
alias j='jobs -l'
# alias edit='mcedit'
# Colorize the grep command output.
alias grep='grep --color=auto'
# Search for a substring (e.g., "text") recursively in the current directory and its subdirectories
alias sub-grep='grep -ri $1 .'
# List all currently running background jobs.
alias jobs='jobs -l'
# Find executable files.
alias where='which'
# Create a directory and move into it.
alias mkdir='mkdir -p'
alias mkcd='mkcd(){ mkdir -p "$1"; cd "$1" }; mkcd'
# Copy files recursively, overwriting existing files.
alias cp='cp -rf'
# Delete a directory and its contents.
alias rm='rm -rf'
# Show the current time.
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
alias dt='date +"%d-%m-%Y %T"'
# Clipboard management using xsel e.g. cat <file name> | pbcopy
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
# Download a file from a website, resuming if interrupted.
alias wget='wget -c'
# Fetch data from a website.
alias curl='curl -L'
# Process Management
# Enhanced process listing.
alias ps='ps auxf'
# Forcefully terminate a process.
alias kill='kill -9'
# Use htop for process management (if installed).
alias top='htop'
# Determine the total size of a specific directory in human-readable format.
alias dir-size='du -sh'
# Display system information and network configuration.
alias meminfo='free -m -l -t'
alias cpuinfo='lscpu'
alias gpuinfo='inxi -G'
alias driverinfo='lspci -k'
alias diskinfo='df -h'
alias blockinfo='lsblk -f'
alias usbinfo='lsusb'
alias osinfo='uname -a'
alias hostinfo='hostname'
alias ipinfo='hostname -I'
alias ethinfo='ifconfig'
alias netinfo='ip addr show'
alias routeinfo='ip route show'
alias portinfo='ss -tuln'
alias currconn='ss -tn | grep ESTABLISHED'
# Creating a tar archive, e.g., tar -cvf archive.tar .
alias tarc='tar -czvf'
# Extracting a tar archive, e.g., tar -xvf archive.tar .
alias tarx='tar -xzvf'
# Checking the contents of an archive, e.g., tar -tvf archive.tar .
alias tart='tar -tvf'
# Recursively compress files and subdirectories within a directory, e.g., zip -r archive.zip .
alias czip='zip -r'
# Test the contents of a zip archive, e.g., unzip -t archive.zip.
alias tzip='unzip -t'
# Extract files from a zip archive, e.g., unzip archive.zip.
alias uzip='unzip'
### DEBIAN/UBUNTU SYSTEM UPDATE ###
alias supdate='sudo apt update'
alias supgrade='sudo apt update && sudo apt upgrade -y'
alias sinstall='sudo apt install'
alias sremove='sudo apt remove'
alias sclean='sudo apt autoremove && sudo apt clean'
# Update Flatpaks
alias fupdate='flatpak update -y'
### RED HAT/FEDORA SYSTEM UPDATE ###
alias dcheck='sudo dnf check-update'
alias dupdate='sudo dnf update'
alias dupgrade='sudo dnf update && sudo dnf upgrade'
alias dinstall='sudo dnf install'
alias dremove='sudo dnf remove'
# Yum-based system update
alias ycheck='sudo yum check-update'
alias yupdate='sudo yum update'
alias yupgrade='sudo yum update && sudo yum upgrade'
alias yinstall='sudo yum install'
alias yremove='sudo yum remove'
# Apply only security-related updates.
alias ysecurityup='sudo yum --security update'
### PYTHON ###
alias ve='python3 -m venv ./venv'
alias va='source ./venv/bin/activate'
alias vd='deactivate'
alias pipup='python3 -m pip install --upgrade pip'
alias piptool='pip install --upgrade setuptools wheel --no-cache-dir'
alias pipins='pip install --no-cache-dir'
alias pipfre='pip freeze > requirements.txt'
alias pipinsreq='pip install -r requirements.txt'
# Jupyter Notebook shortcut
alias nb='jupyter notebook'
### APACHE SPARK AND YARN SESSION ###
alias sparklist="yarn application -list | grep -hi $(whoami) | awk '{print \$1, \$2, \$3, \$4, \$5, \$6}'"
alias sparkstatus='yarn application -status'
alias sparkkill='yarn application -kill'
alias sparklog='view_yarn_logs() { yarn logs -applicationId "$1" -am 1 -log_files stdout; }; view_yarn_logs'
alias sparkwipe="for app_id in \$(yarn application -list | grep -i \$(whoami) | awk -F '\t' '{print \$1}'); do yarn app -kill \$app_id; done"
alias yarntop='yarn top'
### GIT ###
# Initialize an empty Git repository in the current directory.
alias init='git init'
# Basic Git commands
alias status='git status'
alias branch='git branch'
alias remote='git branch -a -v'
alias fetch='git fetch'
alias diff='git diff'
# Clone a repository to the local machine.
alias clone='git clone'
# Add a file to the Git staging area.
alias add='git add'
# Remove a file from the Git staging area.
alias git-rm='git rm --cached'
# Add all files to the Git staging area.
alias add-all='git add -A'
# Add modified files in the current directory and subdirectories to the staging area.
alias add-mod='git add -u'
# Remove files from staging area
alias reset-stage='git reset HEAD -- .'
# Commit changes to the repository.
alias commit='git commit'
# Push changes to remote repositories.
alias push='git push'
alias push-master='git push origin master'
alias push-dev='git push origin development'
# Pull changes from remote repositories.
alias pull='git pull'
alias pull-master='git pull origin master'
alias pull-dev='git pull origin development'
# Restore specific files or entire directories in the working directory.
alias restore='git fetch && git restore'
# Create a new or copy branch and switch to it.
alias new-branch='git checkout -b'
alias empty-branch='git switch --orphan'
alias new-dev-branch='git checkout -b development'
# Switch to an already existing branch.
alias switch='git checkout'
alias switch-force='git checkout -f'
# Show last commit details
alias last-log='git log -1 HEAD'
alias repo-log='git log --oneline'
### DOCKER ###
# Start a container
alias dstart='docker start'
# Stop a container
alias dstop='docker stop'
# Restart a container
alias drestart='docker restart'
# Remove a container
alias drm='docker rm'
# Inspect a container
alias dinspect='docker inspect'
# Show container logs (follow)
alias dlogs='docker logs -f'
# Stop all running containers
alias dstop='docker stop $(docker ps -aq)'
# Run a container and get an interactive shell
alias drun='docker run -it'
# Execute an interactive bash shell inside a running container (useful for debugging)
alias dexec='docker exec -it'
# Get running containers
alias dps='docker ps'
# Get all containers (running and stopped)
alias dpsa='docker ps -a'
# List all images
alias dimages='docker images'
# Remove image
alias drmi='docker rmi'
# Pull image from Docker Hub
alias dpull='docker pull'
# Push image to Docker Hub
alias dpush='docker push'
# Remove all unused images (be careful!)
alias dirm='docker image prune'
# Remove all unused images, containers, networks, and volumes
alias dclean='docker system prune -af --volumes'
# Start services in detached mode
alias dcup='docker-compose up -d'
# Start and rebuild services
alias dcbuild='docker-compose up -d --build'
# Stop and remove containers, networks
alias dcdown='docker-compose down'
# View compose logs
alias dclogs='docker-compose logs -f'
# Restart a specific service
alias dcrestart='docker-compose restart'
# Show disk usage by Docker (images, containers, volumes, cache)
alias ddf='docker system df'
# Show detailed disk usage
alias ddfv='docker system df -v'
# Get the IP address of a container
alias dip='docker inspect --format "{{ .NetworkSettings.IPAddress }}"'
# Visual Studio Code shortcut
# alias code='flatpak run com.visualstudio.code'