Technology Insights

Ruby Interactive Shell: Clear All Variables That Have Been Set In IRB Session

The Interactive Ruby Shell, or IRB, doesn’t have a way to clear all variables that I am aware of besides quitting irb and then restarting irb however you can simulate this by invoking subirbs. Subirbs are jobs underneath the main irb session that will allow you to work within irb on different code at the same time without having to stop irb and restart it. So you can load certain gems from the main irb session and not be required to reload them for each subirb. Below are some examples of how subirbs or irb jobs are used.

Technology Insights

Use Multiple Shells From One Terminal Window on Linux

You can use the Linux screen command to operate multiple shells from one terminal window on Linux. Below is the command to install screen on CentOS Linux.

bash

  1. yum install screen

Using screen is easy. First SSH to your server as you normally would and before running any commands that may take awhile type “screen”. This will start a screen session which will allow you to either run commands in multiple screen windows or detach the screen, close your SSH connection, reconnect another SSH session, and reattach the screen session. Below are some useful screen commands.