Screen/Irssi Setup Tutorial

One of the underused resources utilized in class is the IRC channel.

Mixed with some good old UNIXy capabilities, we can not only take advantage of this great chat technology, but be ever-present in the channel, even if we physically get up and leave (and turn our computer off in the process). As long as the server itself doesn't need a reboot (which does happen from time to time), it works splendidly.

This guide will get you set up with a screened irssi session on Lab46 to the class IRC channel.

If you've already set this up, skip to the end section that details regular usage (and re-attaching to your screen session).

Step 0. Do we have any screens?

If you're not sure if you need to launch a new screen session, a quick and easy test can be performed:

See the part that says “No Sockets found”? That means you do not have any, so proceed to Step 1.

If you do have an existing screen session (or sessions), the result of “screen -ls” will indicate there are screens (and sockets), so you do not need to proceed to Step 1, but instead just issue a “screen -r” (unless you have multiple screen sessions, which you either did intentionally and therefore should know what to do, or accidentally, and will need to ask for some help in clearing the unnecessary ones out).

Step 1. Starting from scratch

This assumes you have yet to establish your screened irssi session for the semester (or the server has been reboot, so you have to go through these steps again), otherwise, if you've already performed these steps, you can skip these steps and just re-attach to your screen session.

First order of business is to actually log in, and have the Lab46 prompt eagerly awaiting your bidding:

lab46:~$

What we need to do now is start ourselves a new screen session:

lab46:~$ screen

When you do this, you will get the screen “Welcome screen”. Just hit enter.

You should now be inside of screen, as is witnessed by the seeing the following:

lab46:~$

What?! Isn't that where I started? Yes.. and is to where you've progressed. If screen is doing its job, you shouldn't notice any difference between an unscreened session and a screened one… if you REALLY wanted to check, you could run a “screen -ls”, and should notice it now claims a screen session, and that it is “Attached”.

Step 2. Connect with irssi

Before we play with screen, let's fire up our IRC client, this nifty command-line program known as 'irssi', and connect to the server and class IRC channel.

Start irssi

So, from within our brand new screen session terminal, do the following:

lab46:~$ irssi

Your terminal should change appearance… the same black background, but probably some blue bars (maybe one at the top and bottom of the terminal)… may or may not have any text there, save for:

[(status)]

hanging out at the very bottom.

Connect to the server

What we want to do now is connect to the IRC server, which can be done by issuing a command from within irrsi, as follows:

[(status)] /server irc

Upon doing this, a bunch of information will appear on the screen. If you read through it, it should indicate you've connected to the IRC server, along with other bits of information that may or may not make any appreciable sense.

Step 3. Join the channel

Almost there! We've just connected to the server, and now must select a channel to join.

Depending on the class, the IRC channel you seek will be different. Here are some examples of class IRC channels that are in use:

unix - for the UNIX/Linux Fundamentals class

asm - for the Computer Organization class

hpc - for the various HPC classes

data - for the Data Structures class

discrete - for the Discrete Structures class

sys - for the Systems Programming and HPC Systems and Networking classes

cprog - for the C/C++ Programming class

Additionally, there is a general channel available for Lab46 help and discussion:

lab46

To join a channel (we're going to use the example of joining the lab46 channel… substitute your actual class channel), we'd do the following:

[(status)] /join lab46

Some more activity should take place on your terminal, which should indicate you've successfully joined the channel. The real tell-tale sign will be your irssi prompt:

[#lab46]

Channels in IRC are prefixed with a #. Now you can type a message and hit enter, and it will show up in the channel. Others in the class are doing the same.

The purpose is to have and maintain a resource for class communications outside of any scheduled class meeting times. This can (and has) come in handy, and also serves as a source for entertainment (you'd be amazed what sometimes happens late at night when some people aren't sleeping).

Now, irssi is a very capable IRC client, and you can do many things with it (as well as screen, but both are beyond the scope of this tutorial). You *can* join multiple channels, it's just a matter of issuing another “/join channel”– you'll have to learn how to navigate, but such topics are great for strumming up conversation in the class chat.

And hey, now you're effectively done with the setup part of this tutorial.

You can move on to the “regular usage” section just ahead…

Regular Usage of your Screen/Irssi session

The big advantage to using screen is that you can have a persistent terminal session, regardless of your physical ability to maintain a connection to the system.

Typically, we've all been exposed to situations where we connect and utilize a resource, then disconnect when we're done. This is necessary because we simply cannot remain logged in constantly.

The abilities 'screen' provides us with allows us to still come and go physically, but logically remain ever present, or persistent, so that we can leave things as they are, without worrying about wrapping up or saving and shutting everything down. Instead, we can leave things running– and here we are, in this specific case, with irssi, so that we can come and go, and so can everyone else, so the conversation is all-inclusive, even if we're not all around at the same time.

To that ends, what follows will be the typical 'screen' usage that you'll want to get used to.

Detaching from your screen session

When you are ready to depart physically from your current location, you need to detach yourself from your existing screen session, allowing it to remain running, while you tend to other matters; logging out, shutting off the computer, etc.

To detach yourself from your currently running 'screen' session:

- press and hold down the CTRL key
- while you hit the 'a' key on your keyboard
- release both, then tap the 'd' key

Your terminal should resemble something like the following:

[detached]lab46:~$

You are now in the original session of your terminal as you logged in. You can log out now.

Re-Attaching to your screen session

After some time away, you've returned, and wish to resume your activities in your screen session.

You log in, and are at the Lab46 prompt.

All you need to do to reconnect to your screen session is to:

lab46:~$ screen -r

And voila! You'll be back where you left off.

Split Screen

Say you want to do some of your work while chatting in the class IRC but don't want to have multiple terminal windows open. Luckily screen is a fantastic utility, and gives you the ability to divide your screen session into multiple different windows for your viewing pleasure. The command to do so is very similar to the command you use to detach from your screen session. Hold Ctrl and press a, now release them both and instead of tapping the d key hold shift and tap s. You should notice your screen shrink. If this happens then you have issued the command correctly. “But there isn't anything there” You say? Fear not, we simply have to navigate to our new split screen by pressing Ctrl+a followed by tab and create a new screen to view by pressing Ctrl+a followed by c. Now you should see a new Lab46 prompt appear in the lower screen. Now you can work and chat all from the comfort and convenience of a single terminal screen.

The End

Basically, that's all you do— detach and re-attach.

That's the basic premise behind screen.

As you get used to it, you may want to branch out and explore some of screen's additional features (there are many, and they are cool).