How to use linux 'screen'

... and avoid using multiple IDL licenses. Written by Mia Morrell & Cory Donofrio.

Lab Home -- People -- Experimental facilities -- Publications -- Experimental pictures -- Links

Here's how to be a considerate lab member and minimize your use of IDL licenses. Suppose you want to run many IDL processes. It's probably a good idea to plan out and record what computer you are going to use for each of these processes before you start running them.

Before you begin: to open a terminal on computer 'computer', open a terminal and type:

        ssh -X computer.physics.emory.edu
You probably already know this.


1) Check license usage. Open a terminal (on any computer) and type:
        lmstat
This will tell you how many IDL licenses are being used, and by whom. Our lab has a maximum of 10 available licenses. If anyone is using more than three licenses, you can rat them out to Eric!

If you are guilty of using excess licenses (shame on you!): Either log out of your excess idl sessions, or to kill all idl processes for user 'username' on a computer type:

        pkill -9 -u username idl
You can see what processes you and others are running on your computer by typing:
        top
You'll get something like this:
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM TIME+ COMMAND     
where PID is the process ID, USER is the user running the process, NI is the nice value (which represents process priority with 0 being high priority), %CPU is the percent of the core you are using (which should be in 80s to 100 if you are running at high priority), and COMMAND is the type of process that is running. The other stuff I have no idea, google it.

And you can see how long these processes have been running by typing:

        uptime

To see just what processes a specific user is running type:

	top -u username
To kill a specific idl process, type:
        kill -9 PID
(where PID is the process ID number you get with the 'top' command)

2) Running processes: Once you have cleaned up (step 1), you can start running processes! Open a terminal on your desired computer and enter:

        screen
Screen is cool because it allows you to run multiple processes from one session, access this session from other locations, and keep this session running despite not having an open shell session. It's uncool because if you aren't careful, you can accidentally use up a ton of licenses if you don't properly log out of/kill IDL processes you don't need anymore (see step 1!).

To start a process in your session, press: CONTROL-A then CONTROL-C This will open a new window in your session. Note that on Mac a new window has been created, but there will not be a different window on your computer screen. When you cycle through your screen windows (see below) they will appear in the same window on your screen. Then launch idl and be awesome. Repeat these keystrokes for every process you want to run on your computer. This way, you can run up to 16 processes on one computer using a single IDL license!

3) Managing your session:

To reattach a window to a session, type:

        screen -r
Screen will print a list of all the sessions you have running if you have multiple sessions you can attach to. Choose the session 'session' you want to attach to, and type:
        screen -r session
To see what screen sessions you are running you can type:
	Screen -list

Have fun using Screen!