Skip to content

Instantly share code, notes, and snippets.

@ijortengab
Created December 26, 2024 07:02
Show Gist options
  • Save ijortengab/edfd4c7abc3fe0792b1bcbb92680d480 to your computer and use it in GitHub Desktop.
Save ijortengab/edfd4c7abc3fe0792b1bcbb92680d480 to your computer and use it in GitHub Desktop.
# Common aliases.
# regular
alias al="vi ~/.bash_aliases && . ~/.bash_aliases"
alias touchh='a=$(date +%Y%m%d%H%M%S);touch ${a}.md'
alias duu='du -d 1 -h 2>/dev/null | sort -hr'
alias dff="df -h | grep -v -E '(loop|tmpfs)'"
alias cc="clear && clear"
alias syslog="tail -f /var/log/syslog"
alias his="history -w && cat ~/.bash_history | tail -n 100"
alias grep='grep --exclude-dir=.git'
alias csv="xlsx2csv -d ';' -f '%Y-%m-%d' -t '%H:%M:%S'"
alias movehere='find -mindepth 2 -type f -exec mv -t . {} \;'
alias movetmp='mkdir tmp; find -maxdepth 1 -type f -exec mv -t tmp {} \;'
alias ed='echo find . -type d -empty -delete; find . -type d -empty -delete'
alias ef='echo find . -type f -empty -delete; find . -type f -empty -delete'
alias ..='cd ..'
alias jpg2gallery='mkdir -p gallery; find -maxdepth 1 -type f -iname "*.jp*g" -exec mv -t gallery/ {} \;'
alias mp42gallery='mkdir -p gallery; find -maxdepth 1 -type f -iname "*.mp4" -exec mv -t gallery/ {} \;'
# nginx
alias ngr="nginx -s reload"
alias ngd="cd /etc/nginx/sites-available"
# systemctl
alias sstop="systemctl stop"
alias sstart="systemctl start"
alias sstat="systemctl status"
# git
alias ga="git add"
alias gs="git status"
alias gdc="git diff --cached"
alias gdh="git diff HEAD~ HEAD"
alias gd="git diff"
alias gl="git log"
alias glo="git log --oneline"
alias gls="git ls-files"
alias gc='git commit'
alias gcm='git commit -m'
alias gpush='git push origin master'
alias gpull='git pull origin master'
alias gsave='git add .; git commit -m "Update All by $(whoami)@$(hostname)."; git push origin master;'
# cd
alias vw="cd /var/www"
alias h1="grep -rn '^# ' | sort -V"
alias h2="grep -rn '^## .* .*' | sort -V"
USERPROFILE=$(wslpath `/mnt/c/Windows/system32/cmd.exe /c echo %USERPROFILE% 2>/dev/null` | sed 's,\r,,')
alias cduserprofile='cd $USERPROFILE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment