Other Pages

Expand All
Slides

Commandline Glossary

~ Called 'tilde'. On OS X or Linux, this is a shortcut to the home directory for your user.

/ When you use an 'escape sequence' in front of a character, the normal interpretation of that character is not applied.

= Assignment to make whatever follows, to be treated as true (Name="Veronica").

== Boolean, a data type with only 2 possible values: True or False (Is name=="Veronica"? True).

cd (or cd ~) Change into your home directory.

cd directory (or cd ..) Change into the parent directory of your current directory.

cd ../../ Go up 2 levels / multiple levels.

cd foo Change into the directory named foo.

cp original.rb copy.rb Makes a copy of the original.rb file.

ls List the contents of your current directory.

ls directory Shows all contents (files and folders) of the directory.

pwd Shows the full path of the directory you are currently in (e.g. /home/heidi/tehcodez/Railsbridge).

-h (or --help) Can be run with all commands to list more helpful information.

puts something Prints its argument to the console. Can be used in Rails apps to print something in the console where the server is running.

git branch Shows you the branch that you're currently in.

git status Shows you any pending changes that you've created since your last commit.

git add -A Will add all your changes to your next commit.

git add file1.md file2.md file3.md Will add only the files you specify to your next commit.

git commit -m "some useful message for your future self" Commits all your changes with your descriptive message to git.

git push origin remote_branch_name This pushes the code in your current branch to the remote_branch_name branch on the remote repo named 'origin'.

rails new NameApp Creates a new Rails application with the entire Rails directory structure to run your application.

rails server (or rails s) Launches a small web server named WEBrick that you will use any time you want to access your application through a web browser.

rails generate (or rails g) Uses templates to create a bunch of directories and files in your application.

rails generate scaffold Creates a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data and a test suite for each of the above.

rake Rake is ‘Ruby Make', used to build up a list of tasks.

rails console (or rails c) Lets you interact with your Rails application from the command line, useful for testing out quick ideas with code and changing data server-side without touching the website.

rails console --sandbox If you wish to test out some code without changing any data.

rails dbconsole (or rails db) Used to figure out which database you're using and drops you into whichever command line interface you would use with. It supports MySQL, PostgreSQL, SQLite and SQLite3.

rails destroy (or rails d) Does the opposite of generate. It will figure out what generate did and undo it.