Chenyun Zhang

--

--

ls displays the list of your current directory

cd + folder name gets you into the desired folder

cd ~ goes back to the home directory

mkdir makes a folder

control + a goes to the beginning of the command

control + u clear the command line

control + e : goes to the end of the command

touch filename: creates a new file

open filename: opens the file

rm filename: removes the file

rm * : removes all files in your current directory

rm -rf + folder name: removes a folder.

pwd: checks which directory you are currently in.

--

--

Unlike other programming languages, Ruby has p, print, puts to print out information to the command line. For Ruby beginners, it might be a little bit confusing to figure out when to use what.

print calls to_s on the object, it doesn’t append a new line.

> print 1,2,3
123 => nil

puts call to_s and add a new line to the output

> puts 1,2,3
1
2
3
=> nil

p calls inspect method and adds a new line. p is more useful for debugging, as it returns the original data type.

> p 1,2,3
1
2
3
=> [1,2,3]

In short:

--

--