irssi For Beginners

Discussion in 'Shell / Command Line' started by steelmanronald06, Jul 9, 2013.

  1. steelmanronald06

    steelmanronald06 Administrator Staff Member Staff Writer

    Messages:
    32
    Likes Received:
    7
    Trophy Points:
    8
    Welcome

    If you're reading this it means you have an interest in using irssi, need some help installing irssi or are just browsing. I use irssi daily in order to communicate with different people in IRC Chat Channels. I use irssi because I don't like dealing with loading up a full Graphical Interface, going through the connection process and then joining channels. I let my personal VPS maintain my IRC connection, through the use of screen, and never have to worry about this. Even if my server restarts for some reason, I merely restart screen and it auto starts irssi with all my settings loaded, connections made and channels joined. So, without further ado, lets begin!

    Installation

    If your using a Debian Based Distribution, or a CentOS Based Distribution, installing Irssi is fairly simple. Everything beyond the installation should work the same way, as it all occurs within the irssi command line.

    Debian Based Systems

    Package managers make installing most software a cinch. Using the apt package manager that comes with Debian, you can install irssi with one simple command:
    Code:
    # apt-get install irssi
    
    CentOS Based Systems

    As with Debian, CentOS has its own Package Manager that makes installing software almost painless. Execute the command below and you're ready to start using irssi on CentOS:
    # yum install irssi

    Initial Configuration

    When it comes to using irssi, it is fairly safe to say that it runs perfect out-of-box. However, some people might require a more tailored environment. I happen to be one of those individuals as I use screen for all of my terminal interactions. The advantage of screen is that I am able to preserve my sessions even if my PuTTY connection dies. This means that I will not be logged out of any IRC chat that I may be in, and end users need never know that I left. It also means that I don't have to keep my computer running 100% of the time as my server is maintaining my IRC session for me.



    Auto Connect

    Since screen plays such a crucial role in my every day terminal use, it is possible that I could be logged out of IRC without being aware of it. Therefore, my screen environment is set up to automatically create a new screen and execute the irssi command. However, this isn't of much help as it only fires up the program. The advantage to using screen was to allow me to automatically connect and stay connected. Thus, it stands to reason that I would like for irssi to automatically connect to each of my most visited servers, auto-join my favorite channels and even execute any necessary commands.
    First, you want to add the Network Name to the list of auto-connect networks. This name can be anything you want, but I try to stick with the actual name of the server or service (i.e. Freenode).

    Code:
    (status) /NETWORK ADD -autosendcmd '^nick mynickname;/^msg nickserv identify password' Freenode
    (status) /NETWORK ADD -autosendcmd '^nick mynickname;/^msg nickserv identify password' Slashnet
    
    Second, you want to add the actual servers to the Network Name. This is fairly easy to do, and you can add multipleservers to each Network. The advantage is if one server is offline it will roll to the second server. Also note that at the end of the following commands you can specify a password, should that server require one, and the 6667 is the default IRC port.
    Code:
    (status) /SERVER ADD -auto -network Freenode irc.freenode.net 6667
    (status) /SERVER ADD -auto -network Slashnet pinky.slashnet.org 6667
    Third, you want to set up the auto join channels. I only auto-join two channels, one for each server, but you are free to add as many as you wish.

    Code:
    (status) /CHANNEL ADD -auto -botcmd "/^msg bot LOGIN <char_name> <password>" #g7 Slashnet
    (status) /CHANNEL ADD -auto #phpfreaks Freenode
    
    Note that on the first example of /CHANNEL I used the -botcmd flag. This is a special flag that is used to send message to any bot that might exist in the IRC Chat. #g7 is a idle chat room that acts like an RPG. Unlike a normal chat, the less you say the higher level you'll get. It is meant to be observed not interacted with. Therefore, the only way to participate is to send that channels bot a private message telling it that you wish to login, what your username is, and what your secure password is.


    Auto Start In screen

    You probably noticed that I mentioned having screen auto-start irssi for me. This is pretty basic. I'll show you how to do this, but it is recommended you read my tutorial on screen. This will show you how to set up a custom status bar, autostart screens, and a few other useful tips & tricks.

    Code:
    # vim ~/.screenrc
     
    screen -t 1 IRC-Client irssi
    Code:
    # screen -DR
    

    The above will allow you to edit screen's default configuration. This is loaded every time you run screen. The second line tells screen to open a new window using the -t flag, make sure it is window 1 (be sure you don't have any other auto-attach screens using 1), names it IRC-Client and executes the command irssi.

    Running irssi

    Now that you have irssi installed and configured it is time to run it. Using irssi is pretty simple, especially if you are comfortable using the command line. If you followed my walk-through above, starting irssi is as simple as executing the command at the terminal.

    Code:
    # irssi
    
    That will automatically load the IRC client and then read in the irssi configuration file. Below are a few other commands that you might find useful while using irssi.
    Code:
    To join a channel:
    /join #channel
    Switch windows where # is 0-9:
    Alt-#
    Query a user:
    /q <nick>
    List users in a channel:
    /n
    Private message a user:
    /m <nick> message
    Display a channels topic:
    /topic
    Perform an action: (e.g. <nick> scratches his nose)
    /me scratches his nose
    To mark yourself as away:
    /away away_message
    Final Configurations

    Themes

    One of the great things about irssi is the ability to use themes. These themes are not the same as you might find in a Graphical Interface, but you can theme your client nonetheless. Some of the common themes might change nick colors depending on their mode, hilight colors and various other aspect.
    In this example we'll use the fear2 theme. This theme has not be altered any from the original theme. First, we need to retrieve the theme and store it in our irssi folder. Run the following from your BASH Terminal:

    Code:
    # wget -P ~/.irssi http://static.quadpoint.org/irssi/fear2.theme
    
    Next, we need to apply the them using /set. Execute the following command within irssi, where "fear2" is the filename omitting the .theme extension. We'll also save the theme so it loads each time we start irssi.
    Code:
    (status) /set theme fear2
    (status) /save
    That's it! You should now have an irssi client that is different than the default out-of-box look & feel.
    Hilight Window
    Now we're going to split the irssi window. On the bottom portion you'll have actual channels. You can change these using the meta keys to change between channels. The top portion will be sectioned off and used for your hilight box. The items that appear in this box depend on what you set with the /hilight command.
    First, you want to get the hilightwin.pl script. To do so, execute the following in your BASH Terminal:

    Code:
    # wget -P ~/.irssi/scripts http://static.quadpoint.org/irssi/hilightwin.pl
    # cd ~/.irssi/scripts
    # cp hilightwin.pl autorun/
    
    Now we need to load the script into irssi. Open the irssi client and execute the following:

    Code:
    (status) /run autorun/hilightwin.pl
    
    Next, create the split window. This is done with the /window command as shown below:
    Code:
    (status) /window new split
    (status) /window name hilight
    (status) /window size 6
    The above commands will create a new split window (as opposed to a "hidden" window, which privmsg, channel, and status windows are by default), call it hilight (so the script knows where to send the information) with a height of 6 lines.
    Now, it is time to determine what will be included in this channel. Unless I have two nicks logged in for some reason, or I'm watching someone elses replies, I'll just tell it to hilight my nickname. This means that if someone says my nickname in a channel not in my view, I'll know. Simply do the following:

    Code:
    (status) /hilight yournickname
    
    That's it! You now have a hilight window to bring things to your attention more easily.
    Advanced Status Bar
    The default status bar in irssi is unhelpful, to say the least, and becomes an eye-sore since it provides no real user value. Therefore, it is best to go ahead and modify it. First, lets add the user count to it. This will give you an idea of how many people are in a channel. First download the usercount.pl file and then execute the following in irssi:

    Code:
    (status) /statusbar window add usercount
    
    Next, we want to list the open windows in irssi. Download the adv_windowlist.pl script and load it into irssi using /runautorun/adv_windowlist.pl . Next we'll get rid of the default status bar (known as the act bar) and load up the new status bar. Do the following:

    Code:
    (status) /statusbar window remove act
    (status) /set awl_display_key $Q%K|%n$H$C$S
    (status) /set awl_block -15
    (status) /save
    
    That's it. You should now have a custom status bar that will be a little bit more useful and a little easier to deal with. Of course you can always get rid of the status bar completely, but why not actually make good use of it?


    Ronald Steelman

    MySQLExchange.com
    Deep Sukhwani likes this.
  2. Deep Sukhwani

    Deep Sukhwani New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hey,
    That's an awesome post.

    Thanks so much for posting such a great piece of information. Its a gem for irssi beginners.

Share This Page