-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
78 lines (65 loc) · 2.77 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
# @see https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet
# Expand alias -> C-x a
# Unix
alias ll="ls -alF" # Detailed list with / for directories
alias la="ls -A" # List almost all files, excluding . and ..
alias l="ls -CF" # Compact list
alias ln="ln -v"
alias mkdir="mkdir -p"
alias e="$EDITOR"
alias v="$VISUAL"
alias ..="cd .."
alias ...="cd ../.."
# Systems
alias sysinfo="~/dotfiles/scripts/system_info.sh"
alias ups="sudo -v \
&& sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y \
&& omz update && upgrade_oh_my_zsh_custom \
&& sudo service apache2 restart && sudo service mysql restart \
&& sudo service apache2 status && sudo service mysql status"
alias gitups="~/dotfiles/scripts/clean_branches.sh \
&& gbinfo"
alias apachestart="sudo service apache2 restart && sudo service mariadb restart"
# Logs
alias lc="sudo truncate -s 0 /var/log/apache2/error.log" # Clear Apache error log
# Security
alias ffl='find . -mtime -1 -printf "%p\t%TY-%Tm-%Td %TH:%TM\t%u\t%g\t%m\n" | column -t | less'
alias files_user="find . -user www-data"
alias lusers="cut -d: -f1 /etc/passwd | sort"
# Pretty print the path
alias path='echo $PATH | tr -s ":" "\n"'
# VSCode
alias code.="code ."
alias vs="code"
# Docker
alias dps="docker ps"
alias di="docker images"
alias drm="docker rm $(docker ps -a -q)" # Remove stopped containers
alias dri="docker rmi $(docker images -q)" # Remove unused images
alias dcompose="docker-compose"
# Useful tools
alias htop="htop"
alias ping="ping -c 5"
alias df="df -h" # Show disk usage in human-readable format
alias free="free -h" # Show memory usage in human-readable format
# Git
alias gst="git status"
alias gaa="git add --all"
alias gcm="git commit -m"
alias gco="git checkout"
alias glg="git log --graph --oneline --all --pretty=format:'%C(yellow)%h%Creset - %s %C(green)(%ad) %C(cyan)[%an]%Creset' --date=format:'%Y-%m-%d %H:%M:%S'"
alias gdf="git diff --color-words --word-diff=color"
alias gdfc="git diff --color-words --word-diff=color -U3"
alias gpl="git pull"
alias gps="git push"
alias gb="git branch -v --sort=-committerdate --color"
alias gbinfo="git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:yellow)%(refname:short)%(color:reset) - %(color:green)%(committerdate:short)%(color:reset) - %(color:blue)%(authorname)%(color:reset) - %(contents:subject)'"
alias gclean="git branch --merged | grep -v 'main\|master\|dev\|*' | xargs git branch -d"
# Alias for saving and pushing changes to GitHub
alias git-save='git add -A && git commit -m "chore: commit save point" && git push origin HEAD'
# Alias for fetching, pruning, and pulling changes
alias git-update='git fetch --prune --all && git pull'
# Include custom aliases if they exist
if [[ -f ~/dotfiles-local/aliases.local ]]; then
source ~/dotfiles-local/aliases.local
fi