User Tools

Site Tools


user:mtaft4:portfolio:howto:screen

Screen Tips

Screen is a powerful utility that allows users to split their attention among various applications. Many of the users on Lab46 use it to keep themselves logged in to the IRCs for their various classes but it can do so much more than that. The following table lists a few useful commands that can be entered during a screen session. All commands expect that the C-a (Control+a) control character has been entered and that the indicated keystroke is entered immediately following.

Command Name Keystroke Effect
Create c Creates a new window and switches to it immediately
Split S Splits the screen into two windows
Switch <TAB> Switches windows
Select 0-9 Selects window 0-9
Title A Changes the title of the window

There are also many command line arguments that are helpful to issue with screen. Many users know that you can open up multiple screen sessions and some even do it without realizing it when they try to get back to their IRC on Lab46. This can be problematic when the default way that screen behaves is to create a new session and stick a PID on it as the only identifier for it. Using the -S switch when starting screen the first time however, allows you to name your screen sessions so that even if you accidentally or purposefully create a new screen session, navigating back to them is easy. For example, this command:

Lab46:~$ screen -S irc

Will create a screen session named irc. It will function exactly as any other screen session would, the only difference? Should you invoke a second screen session with or without the -S there will always be one named irc. This means that whenever you want to get back to your irc screen you can just issue

Lab46:~$ screen -r irc

to get back to the screen with your running irssi session on it. Remember the journal initialization where you had to create a screen, then issue the irssi command then detach from the session? Ever wonder if that could have been easier? Well this little invocation:

Lab46:~$ screen -S irc -md irssi

Will have screen create a new session, name it irc, then run the irssi command in it and detach. Pair this with a decently written irssi config file and that one line can connect you to all of your channels, and detach the screen so that you don't have to mess with getting into the server or your channels if say Lab46 goes down. Of course this can be applied to other commands too. The -md option simply says to create a new session and not attach to it. So say you had a large program to compile that you knew would take a while. Changing the name of the session and substituting irssi for the compiler line for your code will send the job to a new detached screen, so that you can keep your current terminal clutter free and still work on other things without having to open another window.

user/mtaft4/portfolio/howto/screen.txt · Last modified: 2011/03/23 06:48 by mtaft4