Helpful Command Line Aliases for OS X

I started a new job this week and with that comes setting up a new computer.

To help make things easy on myself, I like to set up some Aliases in my .bash_profile so I can get things done in the command line a bit quicker.

If you’re looking for shortcuts for the command line, here’s some helpful ones I’m using.

# See http://www.shellperson.net/using-sudo-with-an-alias/
alias sudo='sudo '

# This helps me edit files that my user isn't the owner of
alias edit='SUDO_EDITOR="open -FWne" sudo -e'

# The alias that takes me here - to editing these very aliases
alias edit_profile='open -e ~/.bash_profile'

# I do a lot of web development, so I need to edit these non-owned files fairly often
alias edit_hosts='nano /etc/hosts'
alias edit_httpd='nano /etc/apache2/httpd.conf'
alias edit_php='nano /etc/php.ini'
alias edit_vhosts='nano /etc/apache2/extra/httpd-vhosts.conf'

# This alias recursively destroys all .DS_Store files in the folder I am currently in
alias killDS='find . -name *.DS_Store -type f -delete'

# This alias reloads this file
alias reload_profile='source ~/.bash_profile'

# Mac get stuck very often and are extremely slow and unstable on shutdowns. This forces a shutdown.
alias poweroff='sudo /sbin/shutdown -h now'

# Setting for the new UTF-8 terminal support in Lion / Mountain Lion
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

# Color listing
alias ll='ls -lGaf'

## Colorize the ls output ##
alias ls='ls --color=auto'

# Show open ports
alias ports='netstat -tulanp'

 

Got any other cool Aliases that you use? Let me know.

Posted by Jason Bahl

Senior WordPress Engineer at Digital First Media in Denver, CO. I love problem solving and working with WordPress. I'm the creator and maintainer of WPGraphQL. I'm passionate about Open Source software and the web. When I'm not writing code, you'll find me spending time with my beautiful wife Rachel and my 2 sons Andrew and Blake. I also enjoy playing and watching soccer.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.