June 7th, 2009

Make .bashrc Work for You with Aliases

fts-unix-frontQuick disclaimer, I’m no command line guru, but I am a huge fan of anything that helps me do my job faster, so I decided to load up someĀ aliases in .bashrc this morning. A perfectly good Sunday morning activity.

I quickly ran in to a problem, though. My aliases weren’t working. The only way I could get them to work was to run source .bashrc. Logging out of Terminal didn’t do me any good, and setting a Terminal startup preference to run source .bashrc only worked for the first new window. Drag. So, to the Google Machine I went.

A simple search for Terminal doesn’t recognize .bashrc returned a helpful thread from macosxhints.com. A quick look at all the files in my home directory revealed no .bash_profile file. Aha! All I needed to do was create that file then add if [ -f ~/.bashrc ]; then . ~/.bashrc; fi and voila, problem solved. Update: After I tried to fire up a Rails project I realized that I should have modified .bash_login on my machine. The mix up caused a little problem where my version of RubyGems wasn’t being found. If you have .bash_login, add the aforementioned line there.

Now I can alias to my hearts content. I like to alias my ssh commands and other common directories that I frequently work from. Below are a few examples of popular aliases as well as how to use alias.

How to:

alias newcommand=”commandToBeExecuted”

Examples:

alias ll=”ls -ltr” #lists, in long form, non-hidden files in reverse order according to most recently modified

alias lf=”ls -F” #returns a file listing with / at the end of directories and @ at the end of symbolic links

alias l=”ls -al” #lists, in long form, all files, even hidden dot files, in long form

alias rm=”rm -i” #this command will prompt you when you attempt to remove a file

As I mentioned, I like to create aliases for quick access to directories I frequent. For example, when I fire up GoComics locally I use the following alias:

alias gc=”cd ~/path/to/gocomics/” #this gets me there no matter where I am in the files.

For more on alias check out http://www.itworld.com/operating-systems/59407/handy-dandy-aliases.

June 5th, 2009

A Developers Responsibility

February 5th, 2009

Annoy Your Friends With Emoji for Free & Without Jailbreaking Your iPhone

February 4th, 2009

Thoughts About My Dad and the Last 25 Years

January 14th, 2009

Growing Up Star Wars Is Stellar

January 11th, 2009

A New Year, A New Website

August 10th, 2008

Man dances in 42 countries

May 23rd, 2008

Electra bikes are more than just great bikes

April 17th, 2008

Words escape me…

April 10th, 2008

Funny instant message typo’s