My dev box, why I like it and some useful commands

As a developer my OS of preference is linux, naturally. I feel linux is giving you the power to do whatever you want if you have plenty of time and will to do some hackish stuff with whatever you can imagine.

I also own a mac and I think it is the best option for a laptop. The main reason I like mac is that it combines the power of console and the most professional programs are available. It is also important to have access to all popular OSes that are available as a developer. I can use OSX with ease and most of the time I am ok, but It gives to my nerves from time to time and I still can't believe there isn't right click->new file on finder! (yes I know this may change and I can use other finder replacement, but that's not an option for many reasons). There are many other stuff that you can't do them with OSX (or you can do them really hard) and I left with a feeling like "Why?". But the looks and feel is cool and the hardware is nice.

Strangely enough, my main pc has windows 7. Yes you heart right! My main pc has windows 7 as a main OS and I consider myself a rails developer. Of course I am running ubuntu with a virtual box (I have two screens so it is like running two OS simultaneously) and I feel like I get the best from these two worlds. Windows offers the most programs you may need and you have everything you can ask, from photoshop, 3D studio max, or any simple and strange program you will find on the internet. But it doesn't have command line and the only languages that is ok with this platform for development, are .NET and ok, maybe java. If you want any other language... tough luck, you are on your own. So I have a virtual box with linux and I can do everything exactly as if I had it natively. I haven't found any important limitation with this setup and I am pretty happy so far (and I can test my apps in internet explorer as well).

So, after this long introduction, I am going to list 5 useful commands that I use most of the time:

lsof -i :port
This command is cool for detecting if something is running on this specific port. For example if you are runnning couchDB on port 5984 and you type lsof -i :5984 you will see the PID and you can easily kill it in case you couldn't with any other way... for some strange reason. Ok, you got the point.

ps aux
This command will show you all the current running processes. With a combination of a pipe and a grep, you can do something like ps aux | grep mysql and find any process with this name. Best task manager ever.

grep -lr "find_me" .
Ok grep is the most powerful command. It will search in the current folder which files have the specific string. With the -lr prefix it will just show the name of the files, if you just type -r it will search and show you exactly the line that contains the specific file.

find . -name post.rb
Ok I wrote about the grep command, so I should also write the find command. The most common use is by name, so I type something like this or find . -name po* when I am becoming too lazy.

That's some common commands I use everyday, if you want more specific commands and extreme hacks and tricks, check out commandline-fu.

Max one mail per week.