🎨 Add more aliases

This commit is contained in:
Gal 2024-01-04 01:48:55 +07:00
parent 3ed66f3cb1
commit de17ea5c27
Signed by: gal
GPG Key ID: F035BC65003BC00B
1 changed files with 64 additions and 9 deletions

View File

@ -4,14 +4,69 @@ alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
alias ~="cd ~" alias ~="cd ~"
# Listing and viewing # Docker
alias ls="ls -G" # Colored output alias dps="docker ps"
alias ll="ls -alh" # Detailed list view alias dimages="docker images"
alias la="ls -A" # List all, except . and .. alias dlogs="docker logs"
# File operations # Shortcuts
alias cp="cp -iv" # Prompt before overwrite, and show verbose output alias d="cd ~/Documents"
alias mv="mv -iv" # Prompt before overwrite, and show verbose output alias dl="cd ~/Downloads"
alias rm="rm -i" # Prompt before removal alias dt="cd ~/Desktop"
alias mkdir="mkdir -pv" # Create parent directories as neededY alias g="git"
alias latest="find . -d 1 | sort | tail -n 1" # find latest file in current dir
# Add notification from terminal for long-running commands
# Must install terminal-notifier: brew install terminal-notifier
# Usage example: sleep 10; alert
alias alert="terminal-notifier -title 'Command finished' -message 'Celebrate! 🎉🎉🎉' -sound default"
# List all files colorized in long format
alias l="ls -lF ${colorflag}"
# List all files colorized in long format, including dot files
alias la="ls -laF ${colorflag}"
# List only directories
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
# Always use color output for `ls`
alias ls="command ls ${colorflag}"
# Colored `grep` output
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Enable aliases to be sudoed
alias sudo='sudo '
# IP
alias localip="ipconfig getifaddr en0"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Get current external IP
alias myexternalip="curl https://canihazip.com/s"
# Delete `.DS_Store` recursively
alias cleandsstore="find . -type f -name '*.DS_Store' -ls -delete"
# Empty trash, system logs, downloads logs
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
# Lock screen
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec ${SHELL} -l"
# Copy pubkey
alias copypubkeyrsa="pbcopy < ~/.ssh/id_rsa.pub"
alias copypubkeyed="pbcopy < ~/.ssh/id_ed25519_sk.pub"
# Copy private key
alias copyprivkeyrsa="pbcopy < ~/.ssh/id_rsa"
alias copyprivkeyed="pbcopy < ~/.ssh/id_ed25519_sk"
# List my gpg keys
alias mygpgkeys="gpg --list-secret-keys --keyid-format LONG"