How to use screen and irssi


I originally wrote this for new-ish geeks at my University (The University of Kent) to help them learn how to use irssi on the Computer Science undergrad machine, Raptor, running Solaris. I have since widened it so that it applies to any *nix machine, and I believe it is a fairly comprehensive guide to using screen and irssi.


Why Screen is awesome

Using screen means that you can get at your irssi session, and any other console applications you choose to run within screen from anywhere you can ssh in to the machine that you are running your session on and as such is a very useful tool. I can, and do, use just one session of screen to run not only irssi, but also mutt for email and occasionally elinks (text based browser) and mplayer (media player), meaning I have access to all these things while I am on the move. Having used screen over five years now I honestly don't know where I would be without it. Although it can be tricky to get the hang of to start with, it is well worth persevering with, which is another reason I wrote this guide.

Getting Started

To get started, ssh into whichever machine you are using to run screen and irssi. You do this by using putty in a Windows environment (free and easily downloadable here. See here for how to fill in the fields) or a terminal in a *nix system (command for this is "ssh user@ipaddress_or_system_address" - see here for an annotated example).

If your machine is accessable on any port other than 22 you will need to use "-p <number>" within your command. See here for an example of how to do it.

Starting irssi and connecting to a server

Once you have logged in, you will have a prompt at which you can type commands:

unix prompt

Here you need to type "screen irssi" and you should then get a black screen with a blue line at the very top and a blue line near the bottom as below.

irssi on start up

To connect to a server you need to type "/connect <server>". For example, to get at the quakenet irc network: "/connect" and for darkmyst the address is "/connect". You can use this command to connect to multiple servers and then use ctrl and x to switch between servers in your status window (usually window 1).

You can also use the command "/server <server>", but using this will disconnect you from the server that you are currently connected to. The use of "/connect" will allow you to be connected to more than one server at the same time.

Joining and parting channels

By now you should be connected to an irc server. To join a channel you simply type in "/j #<channel name>", for example, "/j #cs" will connect you to the channel #cs. /join #channel works just as well as /j.

To leave a channel, simply go to the window number of the channel you are in and type use the command "/part". For more information on "/part" see Closing windows and exiting irssi.

Changing nicks and channels

To change your nickname use the command "/nick <nick>".

changing your nick in irssi

To change between your channel windows and status window pressing the alt key and the number of the window you want to change to will move you to it. For example, if #cs is in window 2, pressing alt and the number 2 will get you to it. For numbers greater than 10 (alt and 0) you can use the letter keys. q represents 11, w is 12 and so on.

The escape key and the number window you want will also work, and in some *nix environments such as X via exceed esc will actually work better than alt and number. On a Mac using esc is generally the only option.

/win <number> will also move to the window you want. This is especially useful if you have more than 20 windows open. Alt/Esc and the sideways arrow keys will move you one window to the left or right depending on which arrow key you press.

What works and what does not for changing windows is down to choice of terminal. To find what works for you comes down to trial and error, so give the methods I've mentioned here a go and see what works for you, and which you feel most comfortable with.

Nick hilighting

You will probably want to set your nick to highlight so you can see when people are talking to you. The command for this is "/hilight <nick>". If someone says the nick(s) that you have set to be hilighted and you are looking at another channel a number in pink on the lower blue bar will show up.

Someone said my nick

If people are speaking in general and not directly at you or your hilighted nick this will be in white on the blue bar.

Someone is talking

Once you have noticed that someone has said your name you can see who it was and what they said as it will be in yellow. This is true no matter which channel you were looking in at the time your nick was said.

Someone is talking to me

There is no limit on the number of words, names or nicks that you can have hilight.

Being "away"

The away command is very useful, as it means that when you are afk (away from keyboard) you can leave a message that will be visible to anyone pming you or doing a /whois on you. To set an away message you type "/away <message>". Examples of what it looks like for the person trying to contact you are below:

what it looks like if someone PMs me
while I am away what it looks like if someone whois me
while I am away

To cancel the away command simply type "/away". When you have done this anything someone said to you or your nick while you were away will show up in your status window.

I'm back

Private messages

To Message someone in private use the command "/msg <nick> <message>". For example "/msg Trapper hello!" will private message me with the word "hello". "/query <nick>" will open a pm (private message) with a person but not send a message - you can type that in seperately. This is useful if you have something to say and you want to avoid the chance that something will accidentally end up in a public channel.

Argh! It's all broken!

If you accidentally freeze screen (usually this happens if you hit ctrl+s or ctrl+a then s) you can fix it by hitting ctrl+q or ctrl+a then q. Another way to potentially break screen is if you it the pause/break button or ctrl+z while window focus is on your terminal (see here if you are not sure what it looks like when you've broken it that way), then you simply need to type fg at the command line (see example here) to bring your irssi session back. The fg trick fixes any other terminal application you may have accidentally broken with ctrl+z or pause/break.

Closing windows and exiting irssi

To close any window in irssi the command "/wc" is the quickest way to do it, though not necessarily the most elegant way. If you're after a slightly cleaner way to leave a channel then "/part" will also work. The advantage to "/part" is you can leave with a message just by putting your message at the end of the command, e.g. "/part it's rubbish in here anyway".

Leaving now

To disconnect from a server you will need "/disconnect" and to end irssi completely "/exit" is the command that you want.

Detaching and re-attaching screen

When you're ready to leave irssi for a while you can detach the screen. This means that any applications running in screen will continue to run while you're not looking at them. To do this simply press Ctrl and A, then D. To close the terminal completely once you have detached screen then press ctrl and D. If you want to get your detached screen back simply log back into the machine running screen and type "screen -r" at the command prompt. "screen -x" works just as well to reconnect your session even if it is still attached somewhere. "screen -r -d" is also very useful for re-attaching screens attached elsewhere. It detaches the session from wherever it may still be attached and re-attaches your screen at the same time.

A copy of my irssi config

I have put a copy of my irssi config onto this site (here) for those who want it to use it. It will require some tweaking to make it work for you as you need to change the server names, hilights and channel names (to suggest just a few of the changes), but it works and its there if anyone wants it. To make it work just copy paste it into a file called "config". When you have finished doing what you want to it move it to your .irssi directory ("/mv config .irssi"). Make sure it is as you want it before you move it because this will overwrite your previous config. Feedback is always welcome.

Some screen commands I have found to be useful

ctrl+a x Locks screen so no one else can use it. Will look similar to this if it has been done correctly.

screen -S <name> If you use this instead of "screen irssi" on starting screen you can name the session. This is very helpful if you use several different screen sessions for very different tasks (e.g. one for irc and email, one for coding) on one machine. To reconnect a named screen is really no different to reconnecting any other screen session, you merely put the name of the screen on the end, for example, "screen -r <name>".

ctrl+a c Creates a new window within screen.

ctrl+a space Switches to the next window within screen. ctrl+a n does the same thing.

Some irssi commands I have found to be useful

/rmreconns Means that if a server is not responding, you can stop irssi trying to connect to it.

/list Lists all the channels on an irc server that are public for to join. It is not a good idea to run this command on large networks as it will take a long time to run and return such a large list that the information is effectively useless.

/script load [pathtoscriptandscriptname] Loads a script, such as which customises your irssi session. To run scripts from star tup without worrying about loading it each time you will need to make an autorun directory in your .irssi directory.To do this make a "scripts" directory in your .irssi directory (this will show up with a ls -la) and within the "scripts" directory make an "autorun" directory. Place scripts you want to run automatically in there.

/ignore ##channelname ALL -PUBLIC -ACTIONS Allows the user to ignore all joins, parts , quits etc without ignoring what anyone actually says.

/window move [windownumber] or /wm [windownumber] Allows you to reposition a window while irssi is running. For example, if you have a channel window at position 5 and you want it at position 2 then change to the channel window and type /window move 2. If you have default aliases set up in irssi then /wm should work just as well.

/topic [space][tab] This autocompletes the channel topic

/ignore [nick] MSG This enables you to ignore someone but only in a PM, meaning you can still see everything the selected user says in a channel

alt and a This allows you to go straight to the highest priority window when more than one is hilighted


For more information on irssi, please see the irssi website. Matt Sparks also has a really excellent guide that is worth looking at.

Pour voir ce tutoriel en français aller ici (merci au Dr ZZ pour la traduction).

Contact me

Any queries, comments or corrections please email me.