Difference between revisions of "Advanced IRC Tips"
Kylehutson (talk | contribs) (Added iTerm2 reference and fixed typos.) |
(add irssi section and conclusion) |
||
Line 23: | Line 23: | ||
There are many of these, but here are some popular options for your OS of choice: | There are many of these, but here are some popular options for your OS of choice: | ||
* Windows: | * Windows: | ||
− | ** [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] | + | ** [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] is probably the easiest one to get started with |
* Mac OS X: | * Mac OS X: | ||
− | ** You don't need to download an app, just launch <code>Terminal.app</code>. Many Mac users prefer [http://iterm2.com/ iTerm2], which is a 3rd party download. | + | ** You don't need to download an app, just launch <code>Terminal.app</code>. |
+ | ** Many Mac users prefer [http://iterm2.com/ iTerm2], which is a 3rd party download. | ||
* Linux: | * Linux: | ||
** No app needed here either, launch a terminal window of your choice (or terminal virtual console) | ** No app needed here either, launch a terminal window of your choice (or terminal virtual console) | ||
Line 102: | Line 103: | ||
==== What if I want to end the session, not just detach from it? ==== | ==== 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 <code>exit</code>. Astute and knowledgable Linux users will note that I did not use the <code>logout</code> command here. That's right, you must use <code>exit</code> to end the screen session because this is technically not a login shell. You can use <code>logout</code> to leave any ordinary session, though. | That's easy, end it like you would any other session: use <code>exit</code>. Astute and knowledgable Linux users will note that I did not use the <code>logout</code> command here. That's right, you must use <code>exit</code> to end the screen session because this is technically not a login shell. You can use <code>logout</code> to leave any ordinary session, though. | ||
+ | |||
+ | === I'm an expert screen user now, when do I start actually chatting? === | ||
+ | Once youy've logged in to cislinux and started screen (make sure you're still attached to your session), now you're ready to fire up irssi, the chat client. To do this just type <code>irssi</code> at the prompt. You should see a mostly blank window with blue bars at the top and near the bottom and a prompt at the very bottom that says <code>[(status)]</code>. This is the default window layout. It's highly customizable, but we won't go into that here. That bottom line is where you do all your typing, be it for messages or commands. All IRC and irssi commands are prefixed with a forward slash (/) character. To get a list of basic commands, try <code>/help</code> at the prompt. Let's jump in, shall we? | ||
+ | |||
+ | ==== Establish your connection ==== | ||
+ | The first thing you'll want to do is connect to an IRC network. Most chatnets are a network of servers. You don't usually pick a specific server. You connect to the network and it picks a server for you. In CIS, we use Freenode. You'll want to issue these commands: | ||
+ | <ol> | ||
+ | <li>Configure the network:</li> | ||
+ | <ul> | ||
+ | <li>If you want your CIS username to be your nick(name):</li> | ||
+ | <pre> | ||
+ | /network add Freenode | ||
+ | </pre> | ||
+ | <li>If you want something else for a nick:</li> | ||
+ | <pre> | ||
+ | /network add -nick somethingelse Freenode | ||
+ | </pre> | ||
+ | </ul> | ||
+ | <li>Configure the server (the <code>-auto</code> flag here means you want to automatically connect to this network when you start the client next):</li> | ||
+ | <pre> | ||
+ | /server add -auto -network Freenode irc.freenode.net | ||
+ | </pre> | ||
+ | <li>And now connect to it:</li> | ||
+ | <pre> | ||
+ | /connect -network Freenode irc.freenode.net | ||
+ | </pre> | ||
+ | </ol> | ||
+ | If your conenction was successful, you should get a boatload of text dumped to the screen. Congratulations! You connected to a server! | ||
+ | |||
+ | ==== Join a channel ==== | ||
+ | You're now on the network, you want to join a chatroom or "channel". Channels usually have a # as the first character as their name, This is how you know it's a channel. There are probably millions of channels. If you try to use the <code>/list</code> command to get them all, you'll probably get kicked from the server. You don't want that, so it's best to know what channel you want to join. You can join as many channels as you want. Let's configure and join the CIS channel: | ||
+ | <pre> | ||
+ | /channel add -auto #ksucis Freenode | ||
+ | /join #ksucis | ||
+ | </pre> | ||
+ | You should now see a message that you've joined the channel, followed by a list of everybody who's currently in there, followed by some info about the channel. Now, as people talk, you'll see it feed by here. You'll also notice your status prompt now looks like <code>[#ksucis]</code>. Anything you type after the prompt, as long as it isn't a command, will now appear in the chat window for everybody to see. | ||
+ | Woohoo! You joined a channel and can now chat like the cool kids! | ||
+ | |||
+ | ==== Next steps ==== | ||
+ | Now that you've got everything setup, you'll want to save this so you don't have to do it again. Irssi prefers that you do this through the application and not by editing the config file. To save the current state as it is right now, just use the <code>/save</code> command. | ||
+ | |||
+ | Irssi has a ton of reatures. See [http://irssi.org/beginner/ this doc] for some helpful starter tips. | ||
+ | |||
+ | You'll probably want to look at getting some helpful addons, like colorizing nicks to keep track of converations better. You'll probably also want to enable "nickalerts" so you know when somebody mentions you in the channel. You might also want to look at enabling logging, in case you want a more permanent record of a chat or channel. You can also look at customizing the layout of your irssi window, if you don't like the default. It's very flexible and extendable. All this is well-documented on the [http://irssi.org/documentation irssi website]. | ||
+ | |||
+ | If you ever want to exit irssi, use the <code>/quit</code> command. | ||
+ | |||
+ | === Irssi is awesome! What now? === | ||
+ | You now have all the pieces to endless IRC bliss: | ||
+ | * you can connect to the cislinux shellserver | ||
+ | * you can start a new screen session | ||
+ | * and you can start irssi and join a channel | ||
+ | Now you just need to put these pieces together. | ||
+ | |||
+ | If you disconnect from your screen session while your irssi session is running, when you reconnect to it later, you'll come right back to where you left off. And since irssi has kept your irc session open all this time, you can pageup/scrollback to see all the amazing conversation you missed. | ||
+ | |||
+ | The #ksucis channel is for people who want help in CIS, or just want to hang out online. There are tons of other channels and tons of other networks. For example, if you decide you really like Linux, you can join the official K-State Linux Users Group channel (#k-slug), and get help from and hang out with other Linux users from here and from the surrounding area. Irssi, and pretty much any other irc client, will let you connect to as many of these as you want. If you add them as outlined above and <code>/save</code> your settings, you will always be reconnected if you close and restart the client. | ||
+ | |||
+ | === You guys are awesome! I want to give you gifts! === | ||
+ | Gifts and adoration are always welcome! See us in N116 and N119 to bestow them upon us, or if you just need help with something. I guess we can do that, too. |
Revision as of 11:02, 31 March 2015
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 is 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.
I'm an expert screen user now, when do I start actually chatting?
Once youy've logged in to cislinux and started screen (make sure you're still attached to your session), now you're ready to fire up irssi, the chat client. To do this just type irssi
at the prompt. You should see a mostly blank window with blue bars at the top and near the bottom and a prompt at the very bottom that says [(status)]
. This is the default window layout. It's highly customizable, but we won't go into that here. That bottom line is where you do all your typing, be it for messages or commands. All IRC and irssi commands are prefixed with a forward slash (/) character. To get a list of basic commands, try /help
at the prompt. Let's jump in, shall we?
Establish your connection
The first thing you'll want to do is connect to an IRC network. Most chatnets are a network of servers. You don't usually pick a specific server. You connect to the network and it picks a server for you. In CIS, we use Freenode. You'll want to issue these commands:
- Configure the network:
- If you want your CIS username to be your nick(name):
- If you want something else for a nick:
- Configure the server (the
-auto
flag here means you want to automatically connect to this network when you start the client next): - And now connect to it:
/network add Freenode
/network add -nick somethingelse Freenode
/server add -auto -network Freenode irc.freenode.net
/connect -network Freenode irc.freenode.net
If your conenction was successful, you should get a boatload of text dumped to the screen. Congratulations! You connected to a server!
Join a channel
You're now on the network, you want to join a chatroom or "channel". Channels usually have a # as the first character as their name, This is how you know it's a channel. There are probably millions of channels. If you try to use the /list
command to get them all, you'll probably get kicked from the server. You don't want that, so it's best to know what channel you want to join. You can join as many channels as you want. Let's configure and join the CIS channel:
/channel add -auto #ksucis Freenode /join #ksucis
You should now see a message that you've joined the channel, followed by a list of everybody who's currently in there, followed by some info about the channel. Now, as people talk, you'll see it feed by here. You'll also notice your status prompt now looks like [#ksucis]
. Anything you type after the prompt, as long as it isn't a command, will now appear in the chat window for everybody to see.
Woohoo! You joined a channel and can now chat like the cool kids!
Next steps
Now that you've got everything setup, you'll want to save this so you don't have to do it again. Irssi prefers that you do this through the application and not by editing the config file. To save the current state as it is right now, just use the /save
command.
Irssi has a ton of reatures. See this doc for some helpful starter tips.
You'll probably want to look at getting some helpful addons, like colorizing nicks to keep track of converations better. You'll probably also want to enable "nickalerts" so you know when somebody mentions you in the channel. You might also want to look at enabling logging, in case you want a more permanent record of a chat or channel. You can also look at customizing the layout of your irssi window, if you don't like the default. It's very flexible and extendable. All this is well-documented on the irssi website.
If you ever want to exit irssi, use the /quit
command.
Irssi is awesome! What now?
You now have all the pieces to endless IRC bliss:
- you can connect to the cislinux shellserver
- you can start a new screen session
- and you can start irssi and join a channel
Now you just need to put these pieces together.
If you disconnect from your screen session while your irssi session is running, when you reconnect to it later, you'll come right back to where you left off. And since irssi has kept your irc session open all this time, you can pageup/scrollback to see all the amazing conversation you missed.
The #ksucis channel is for people who want help in CIS, or just want to hang out online. There are tons of other channels and tons of other networks. For example, if you decide you really like Linux, you can join the official K-State Linux Users Group channel (#k-slug), and get help from and hang out with other Linux users from here and from the surrounding area. Irssi, and pretty much any other irc client, will let you connect to as many of these as you want. If you add them as outlined above and /save
your settings, you will always be reconnected if you close and restart the client.
You guys are awesome! I want to give you gifts!
Gifts and adoration are always welcome! See us in N116 and N119 to bestow them upon us, or if you just need help with something. I guess we can do that, too.