Run your Ruby file by typing ruby
and then the name of the file you want to run in the Terminal.
If we want to run main.rb
, we can write the command:
ruby main.rb
To re-run this command, you can use the UP and DOWN arrow keys to look at the history of all commands you've run in a particular Terminal.