0

Ruby on Ubuntu

Ruby is very popular language but it does not come preinstalled on Ubuntu as of Ubuntu 15.10. But anyhow it is easy to get started with it.

It can be installed using the following command using the apt package manager:
$ sudo apt-get install ruby-full

Once installed you can check the version using the following command:

$ ruby -v

And in order to go to live interactive REPL mode you can use the following command:

$ irb

Note: Use Ctrl+D to exit from the irb.

Running a script/program:

Create a file for example “hello.rb” and write the following code in it.

puts "Hello World!"

And in order to run use the following command in the terminal:

$ ruby hello.rb
Hello World!

I hope this is useful.

Here is a complete guide to ruby installation on different platforms.

Happy programmer

humayun