Advanced IRC Tips
So you want to be one of the cool geeks with hardcore IRC skillz? Here's how to look more l337.
Note: The contents of this page are intended to be humorous. We're not trying to insult anybody or scare you off, we're just keeping a light tone. All are welcome here. Seriously.
Starting a new IRC session everytime you get online is for n00bs. You annoy everybody in the channel with your part/join spam and you miss out on stuff that happens when you aren't there. If you really want to be one of the cool kids, you'll run irssi in a screen or tmux session on a Linux host and connect to it using an SSH client.
Wait... what?
It's OK, it's not that complicated once you know what all the pieces are:
- irssi: a commandline IRC client
- screen: a tool that lets you start a terminal session and instead of exiting, lets you detach from it and let it keep running while you're gone, and then reattach to it later
- tmux: similar to screen but with a few more bells & whistles
- Linux: quite possibly the greatest operating system and software ecosystem on the planet
- SSH: Secure SHell, basically remote commandline access over a secure connection
OK, so now what?
Lucky for you, all of these things are available to all CIS students, faculty, and staff. You don't need to go off and set up your own Linux server and/or desktop and install and configure these things from scratch. (Although if you did, that would be totally cool and you should jump in another cool IRC channel #k-slug.) You can do all of this from the CIS public Linux shellserver, available from anywhere in the world via SSH: cislinux.cis.ksu.edu
.
Quick Note: When you connect to cislinux.cis.ksu.edu
, you will actually be connected to one of two servers, viper.cis.ksu.edu
or couger.cis.ksu.edu
. Keep track of which one it actually is, you'll need that info later.
You will, however need to get an SSH client to run on your own system so you can connect to cislinux (viper or cougar).
SSH Clients
There are many of these, but here are some popular options for your OS of choice:
- Windows:
- PuTTY: probably the easiest one to get started with
- Mac OS X:
- You don't need to download an app, just launch
Terminal.app
. Many Mac users prefer iTerm2, which is a 3rd party download.
- You don't need to download an app, just launch
- Linux:
- No app needed here either, launch a terminal window of your choice (or terminal virtual console)
Logging in using SSH
From this point forward, I'm assuming you're connecting to CIS resources. If you have your own host setup somewhere, substitute your own info wherever appropriate.
If you're using a GUI SSH client, all you need to know is the hostname you're logging into: cislinux.cis.ksu.edu
, viper.cis.ksu.edu
, or couger.cis.ksu.edu
. Enter that in an appropriate box and click Connect
, or Open
, or OK
, or whatever else your app uses.
If you're using a terminal, just type ssh <hostname>
and hit <Enter>
, where <hostname> is something appropriate from one of those listed above.
When prompted, use your CIS username and password. This is what you use to login to any of our department computers. If your client gives you any kind of notice about confirming the "server's key fingerprint" or something like that, just click OK. This is just establishing a trust between your client and the server that this host is legit. You won't be asked again on this client for this host unless the host's key changes.
If you entered everything correctly, congratulations! You've got a commandline shell!
Um... OK...
The first thing you will want to do is familiarize yourself with Linux and the commandline. You don't need to be an uber-hax0r, but familiarizing yourself with some basic info would be useful. See these pages for some good info to get started.
The important thing here is that Linux generally makes a lot of sense. Most command have a manual ("man" page), which you can access by running man someapp
. Most of them also have quick help available by running someapp --help
, which usually displays various options and general usage. Don't worry, and don't despair. And whatever you do, don't ever run rm -rf $HOME
if somebody tells you to. (At least not if you care about any files you may be saving in your home directory.)
I've managed to login and not delete my homedir, now what?
Here's where things get interesting. You'll notice that if you log out right now or close your session window, the next time you login, you get a brand new session. The session you just left is now closed and done. What we want is a way to keep that session open without losing anything currently running.
That's where screen
and tmux
come in. Both of these tools allow you to start a session and disconnect from it while leaving it running. This is helpful for doing things like starting a long compile process or zipping a bunch of files, but you don't want to sit and watch it while it's going on. Or, perhaps, starting an IRC client that you want to leave and come back later without missing all the juicy conversation.
For this document, I will demonstrate using screen as I have been using it longer and am more familiar with it. You can do all of these things with tmux, it's just that the commands will be slitghtly different.
Using screen
Starting a new session
Once you've logged in, you start a new screen session by typing screen
. This starts the app and shows you a nice copyright page with the GNU abbreviated blurb (yay Free Software!). See at the bottom where it says [Press Space or Return to end.]
? You should follow those instructions to close the copyright page.
Now your terminal should look like... well, exactly like it looked before you started screen. Congratulations! You've started your screen session. We can check to make sure by tell screen to list all the screens you own, using the -ls
parameter:
cougar:[~]$ screen -ls There is a screen on: 29262.pts-9.cougar (03/30/2015 05:00:03 PM) (Attached) 1 Sockets in /var/run/screen/S-sgsax.
Oh look, we have one screen session running that we own and we're currently attached to us. Yay! It worked!
Disconnecting from a session
Now that we've started the session, eventually, we'll want to disconnect from it so we can come back to it later. To do this, use the key combination <ctrl>-A D
. (That's the Control
or CTRL
key on your keyboard.) Afterwards, you should see this on your terminal window:
[detached from 29262.pts-9.cougar] couger:[~]$
And when you list your sessions:
cougar:[~]$ screen -ls There is a screen on: 29262.pts-9.cougar (03/30/2015 05:00:03 PM) (Detached) 1 Sockets in /var/run/screen/S-sgsax.
Huzzah! You were able to detach from your screen session and leave it running!
Reconnecting to a session
So you started your session, and disconnected, now you want to reconnect. Do do this, use the -r
commandline option.
If you only have one session, just use screen -r
to reattach to it. If you have more than one (yep, you can pretty much start as many screen sessions as you want on a host, you just have to keep track of them when you want to reconnect later), run screen -ls
to get a listing and look at that first number in the row representing the session you want back. Using our earlier example: screen -r 29262
.
Voila! You've just reconnected to your old session!
Session number? That's hard!
Keeping track of session numbers can be tricky, especially if you leave a lot of sessions running. Luckily, you can name them when you start them so you can easily refer to them later. Use the -S
flag for this (note: that's a capital S, case matters in Linux):
cougar:[~]$ screen -S cleverboy [...] cougar:[~]$ screen -ls There are screens on: 30318.cleverboy (03/30/2015 05:19:31 PM) (Attached) 29262.pts-9.cougar (03/30/2015 05:00:03 PM) (Detached) 2 Sockets in /var/run/screen/S-sgsax.
See, there's the one we started earlier that we're currenty detached from, and the one we started just now with the name cleverboy
that we are currently attached to.
What if I want to end the session, not just detach from it?
That's easy, end it like you would any other session: use exit
. Astute and knowledgable Linux users will note that I did not use the logout
command here. That's right, you must use exit
to end the screen session because this is technically not a login shell. You can use logout
to leave any ordinary session, though.