views:

117

answers:

6

Hello. I'm just starting to learn Ruby on Rails and I'm developing on a Mac. I'm new to both Mac and Linux and I find myself already struggling to use the commands I need to get things done. For example, I started the rails sever using the :> rails server -d command and I couldn't figure out how to stop it. Ctrl-c, as mentioned in the tutorials, didn't work since it was a detached process using the -d switch. After searching google, I found the lsof|grep ruby helped me locate the running process and kill -9 pid stopped it. I've spent the last twelve years developing on Windows and I've never used or seen any of these linux commands before. It makes me nervous attempting to develop is such an unfamiliar environment. A bigger concern is not knowing my way around the server once the app is deployed and running and I have to start troubleshooting and fixing issues that arise.

I'm going to attempt to read up on linux and learn the OS better, but I wanted to ask up front which Linux commands should I become familiar with as I begin to learn Ruby on Rails?

Thanks so much in advance for your help!

+2  A: 

I'm not sure about the specific commands associated with learning Ruby in general, but you should probably at least get comfortable with navigation: ls, mv, cd, etc. You can get a pretty good grip on the command line at this site: http://linuxcommand.org/

Edit: This is assuming you're developing solely on the command line, of course. If you have a gui obviously the above isn't necessary, though I'd still recommend familiarizing yourself in case you're ever stuck in a CLI-only environment.

waffle paradox
+1  A: 

There aren't any commands you should have to use while developing RoR beyond the usual cd, ls, mv and cp, all of which can be accomplished from your file manager of choice.

In this specific case, the problem was detaching the server in the first place. Leave it running in a second terminal so you can inspect its output and kill/restart it easily.

Working on the command line you'll find yourself invoking certain Rails scripts for running migrations and generating scaffolding, but these are pretty self-evident and not really Linux-specific.

meagar
running it in a second command line is an excellent tip, thank you!
BeachRunnerJoe
+1  A: 

Linux is not really a hard requirement for development on Ruby. I suggest get a good book on Rail and make a demo app. A very simple app which does something. You will everything you should know, from basic commands perspective.

But extra knowledge never kills and if you want some basic know how of linux command, you can use Pocman (a handy commands guide for basic linux commands)

zengr
+1  A: 

Aside from the normal navigational commands, you will also need to know how to run rails tasks (rake, etc) I would also throw in some git knowledge in there as well

Jimmy
+2  A: 

I sometimes use the "find" command witht the "-mtime" option, which will show you files that have been modified within the last so many days. For example, if I can't remember a file I worked on a day and a half ago, I can use the following to show files that have been modified within the last 2 days:

find . -mtime -2
Tim
+1  A: 

I just started with rails about 2 months ago and before that I did mostly asp.net with Visual Studio. Like you, rails was pretty much my first look at unix commands. I went to the extreme though and decided to use VIM as my editor rather than relying on an IDE (RadRails, Aptana, etc). If you go the same route I did you will have a much steeper learning curve! If you use an IDE it'll probably be much easier but not nearly as interesting or fun IMHO :)

If you go the same route I did you'll need to learn about vim and it's many plugins like rails.vim, fuzzyfinder, snippets, NERDTree. I use MacVim and I've installed the very cool visor for terminal. Of course you'll also need to learn how to use Git for source control. Along with that you'll want to learn about MacPort and rvm. I don't think these things are necessarily unix specific but if you're coming from windows development these are all the new things you'll need to learn.

MakeM
Thanks, MakeM! I'm still learning all the tools and RVM and MacPort look great and I've never heard of them, so thank you! Can I ask what the importance is of using MacPort, or why you use it?
BeachRunnerJoe
You know, I don't remember what I used MacPorts for. I think I used it to install Git. It seems that Homebrew is preferred over MacPorts now so look into that. Also, another alternative to Vim for writing the code is TextMate. I however stick with MacVim because I like to use my mouse as little as possible (makes my wrists hurt less)
MakeM
I forgot to mention you'll also want to learn TDD. Using TDD you can look at your browser less and focus more on the code, it's pretty amazing. You can also keep your tests running in the background AS YOU CODE using autotest (there's a new alternative but i forget the name right now). Let me know how it goes!
MakeM