Last active
October 19, 2021 12:33
-
-
Save chesio/61d7659a3a171dcb9de7f372e5f4fdc8 to your computer and use it in GitHub Desktop.
Useful Bash aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Working with shell | |
# - [r]e[m]ove [d]irectory | |
alias rmd='rm -rf' | |
# - [l]ist in [h]uman format | |
alias lh='ls -lh' | |
# - [l]ist [u]sage | |
alias lu='ls | xargs -d "\n" du -sh' | |
# - [l]ist [u]sage [s]orted | |
alias lus='ls | xargs -d "\n" du -sh | sort -hr' | |
# - [less] with e[s] | |
alias lesss='less -S' | |
## cUrl | |
# - show response headers | |
alias curl_headers='curl -s -I -X GET' | |
# alias curl_headers='curl -s -D - -o /dev/null' | |
## Random utils | |
# - pseudo random string (append length parameter) | |
alias pseudorandomstring='< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c' | |
## Syncing (and deploying) | |
# Sync a (git) repository | |
# Params: -[r]ecursive -preserve [t]imestamps -compre[z] -[v]erbose | |
# Also, exclude any hidden files and directories. | |
alias rsync_repo='rsync -rtzv --delete --delete-excluded --exclude=".*"' | |
# Deploy web (development to production) via rsync | |
# Note: add trailing slash to <src-dir> in order to sync directory contents rather than directory itself (adding trailing slash to <tgt-dir> makes no difference) | |
# Example: rsync_web ~/local/project_dir/ ~/remote/project_dir/web/ | |
# Params: -[r]ecursive -preserve sym[l]inks -preserve [t]imestamps -compre[z] -[v]erbose | |
alias rsync_web='rsync -rltzv --delete' | |
## Sysadmin | |
# Debian: list all services ([-] stopped or [+] running) | |
alias list_services='service --status-all' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment