dotfiles/dot_zsh/aliases.zsh

75 lines
2.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Directory navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Docker
alias dps="docker ps"
alias dimages="docker images"
alias dlogs="docker logs"
# Shortcuts
alias d="cd ~/Documents"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
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 }'"
# 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"
# Get current external IP
alias myexternalip="curl https://canihazip.com/s"