If you're already somewhat familiar with tmux and Irssi, feel free to just refer to the basic steps in the TL;DR section below. For more details and options, check out the more in-depth configuration steps farther down the page.
Terminal multiplexer (tmux)
From the tmux
man page: tmux
is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux
may be detached from a screen and continue running in the background, then later reattached. tmux is an alternative to the screen command.
Irssi
Irssi is a terminal-based Internet Relay Chat (IRC) client for *nix systems. From the Irssi man page: Irssi is a modular Internet Relay Chat client. It is highly extensible and very secure. Being a fullscreen, termcap based client with many features, Irssi is easily extensible through scripts and modules.
[ You might also like: Using word modifiers with Bash history in Linux ]
TL;DR
I use Irssi for my IRC client and run it inside of a tmux
session. To set that up, SSH with your Kerberos name to your shell server or jump server: jump_server
. Save this configuration file: tmux config file (.tmux.conf) in ~/
, start tmux
, save the Irssi config file (config) to your ~/.irssi/
folder, set your name and IRC nick in the Settings section at the bottom of the config file, and then start irssi
. Once inside of Irssi, run:
[(status)] /connect <irc_server>
To join other channels:
/join #whatever
To change your nick:
/nick newname
To private message somebody:
/query otherperson
To change which room/query is shown:
Alt + left or right arrow key
Or
Alt + 2, 3, 4, 5
And that will jump to that screen. I know that #sbr-sysmgmt is in #2, so Alt + 2 will take me to that room. To list the people in a channel:
/who #sbr-sysmgmt
Or
/names
And that will list all of the people in the current room.
To exit tmux
but leave IRC running:
Control + a, release Control, d
To resume your SSH + tmux session, enter:
/usr/bin/ssh -t <jump_server> tmux attach
I have a startup script at the end of this document that you can use.
More in-depth documentation
I use Irssi for the client for a few reasons. Mainly, I prefer it because it’s run in a console rather than as a standalone application. Because of that, I can run it in an SSH session if the remote server has Irssi installed. To make it more permanent, I then run Irssi inside of a tmux
session. That means I can connect to the VPN and then run a command: /usr/bin/ssh -t <jump_server> tmux attach
, which connects me via SSH to the remote server and automatically attaches my tmux
session, which has Irssi running.
Configure tmux
To set this up from scratch, SSH to the jump_server server. After that, use curl
, wget
, or whatever to get the tmux.conf
file (unless you already have a tmux.conf
) from my tmux config file, and save it as your .tmux.conf
. Here is additional information from the man page for tmux
:
-f file Specify an alternative configuration file. By default, tmux loads the system configuration file from /etc/tmux.conf, if present, then looks for a user configuration file at ~/.tmux.conf.
Now that you have ~/.tmux.conf
, you can start the tmux
program. This is basically the same thing as screen
if you’re familiar with it. If not, tmux
lets you start a command, disconnect from the session (which normally would kill your running command), restart your SSH session, and attach back to the session where your command is still running. To see this, start tmux
with this command:
$ tmux
Then start pinging Google:
$ ping google.com
While the ping
is going, disconnect from your tmux
session. To do that, press Control + a, release the Control key, and then press d. You should be back at the main SSH screen. Feel free to disconnect from the SSH session and then reconnect. To see your tmux
sessions, run the following command:
$ tmux ls
You should see your one session listed. To attach back to it, type:
$ tmux attach
You should be back to your ping
command, which is still running. You can have multiple tmux
sessions, so to attach to a specific one, first list them and then specify which session to attach:
[pgervase@jump_server ~]$ tmux ls
0: 1 windows (created Mon Jan 20 08:06:24 2020) [211x51] (attached)
3: 1 windows (created Fri May 8 11:38:38 2020) [154x39]
[jump_server] [11:39:06 AM]
[pgervase@jump_server ~]$ tmux attach 3
For my purposes, I typically have only one tmux
session on this server so that I can pass just tmux attach
to my SSH command and not have any issues with connecting to my Irssi session.
Configure Irssi
At this point, you have an introductory knowledge of using tmux
. It's fairly straightforward for basic use cases, and fortunately, all I care about is that basic usage. Now, for Irssi configuration. Save the Irssi config file to your ~/.irssi/
folder, set your name and IRC nick in the Settings section at the bottom of the config file, and then start irssi
. Once inside of Irssi, connect to the Red Hat IRC server:
[(status)] /connect <irc_server>
Hey, hey, you’re using IRC!
To join other channels:
/join #whatever
To change your nick:
/nick newname
To private message somebody:
/query otherperson
To change which room/query is shown, select:
Alt + left or right arrow key
Or
Alt + 2, 3, 4, 5
And that will jump to that screen. I know that # sbr-sysmgmt is in #2, so Alt + 2 will take me to that room.
To list people in a channel:
/who #sbr-sysmgmt
Or
/names
And that will list all of the people in the current room.
To leave tmux
but leave IRC running, select:
Control + a, release Control, and select d
To resume your SSH + tmux session, run:
/usr/bin/ssh -t <jump_server> tmux attach
[ Get this free ebook: Managing your Kubernetes clusters for dummies. ]
Wrap up
Here’s the startup script I use each morning that connects me to my VPN (VPN1 or VPN2), does a kinit
, and then connects me to the SSH server:
#!/bin/bash
#### First things first, wait for network connection
echo "step 1: ping google"
until ping -c 1 8.8.8.8 > /dev/null; do sleep 2; done
echo "step 2: stop any old vpn"
/usr/bin/nmcli connection down "VPN1"
/usr/bin/nmcli connection down "VPN2"
echo "step 3: token --- get your token for the vpn"
echo "step 4: start new vpn1 vpn"
/usr/bin/nmcli --ask connection up "VPN1"
#/usr/bin/nmcli --ask connection up "VPN2"
/usr/bin/sleep 5
echo "step 5: kinit"
until /usr/bin/kinit; do
echo "something didn't work, so shutting down vpn..."
/usr/bin/nmcli connection down "VPN1"
echo ""
echo "redo step 3: token"
/usr/bin/echo ""
echo "starting new vpn2 vpn..."
/usr/bin/nmcli --ask connection up "VPN2"
#/usr/bin/nmcli --ask connection up "VPN1"
/usr/bin/sleep 5
echo "kinit..."
date
#/usr/bin/kinit
date
done
echo "ssh for irc"
/usr/bin/ssh -t <jump_server> tmux attach
There you have a simple way to manage the Irssi sessions via tmux. Take just a few minutes to learn the process, so that you will gain some efficiency and convenience.
About the author
I am a Senior Principal Security Architect at Verizon. Before that, I worked at Red Hat in various roles such as consulting and in the Solutions Architect where I specialized in Smart Management, Ansible, and OpenShift. In my free time, I enjoy spending time with my family, exercising, and woodworking.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit