Bash aliases are awesome. They can save you keystrokes and give you shortcuts to some of your most used commands. I’ll share some of my own down in the answers.
What’s in your .bashrc file? What bash aliases have you found the most useful?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
alias myips="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"
shows a listing of your IP addresses, works great if you have multiple /dev/eth* (OSX/nix)
Ha ha I have this one:
alias PANIC="espeak 'OH NO, the sky is falling'"
Everyone in the office just rolls their eyes
Here are a few more of my favorite aliases.
Show/hide hidden files in the macOS Finder:
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
Limit ping to five ECHO_REQUEST packets:
alias ping='ping -c 5'
Display drives and space in human readable format:
alias drives='df -h'
Run this one in ~/ to discover what folders are using the most space:
alias usage='du -h -d1'
Colorize grep output
alias grep='grep --color=auto -n'
Clear the screen (can’t live without this one!)
alias c='clear'
That’s all, folks!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.