Report this

What is the reason for this report?

What are your favorite bash aliases?

Posted on September 2, 2016

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.