Search code examples
keyboard-shortcutscloud9-ide

Cloud9 IDE - Terminal shortcut to start rails server


i'm new to development in general and I'm starting with rails. I learned via the Hartl Rails Tutorial (and a few other resources) and am using cloud9 IDE. I noticed that every time I want to launch the server in C9 i need to type the following:

rails s -b $IP -p $PORT

Is there a shortcut, hotkey, alias etc so I can simply type something like "rails s"? Seems unnecessarily annoying to have to type that whole thing out every single time.

Thanks!


Solution

  • To do this, you'll need to set a bash alias. To launch it with "launchRails" you'd add a line like this to your ~/.bashrc or ~/.bash_aliases files (either one will work):

    alias railsAlias="rails s -b $IP -p $PORT"
    

    You can open up those files with c9 ~/.bashrc.

    For a multi-word alias like "rails command", you might consider a solution like this one.


    Source: How and where to set bash alias