Send message to IRC channel from bash

IRC is a simple text and line oriented protocol, so it can be done with the basic linux tools. So, without installing ii:

echo -e 'USER bot guest tolmoon tolsun\nNICK bot\nJOIN #channel\nPRIVMSG #channel :Ahoj lidi!\nQUIT\n' \
| nc irc.freenode.net 6667

In this command, nc does the network connection, and you send a login info, nick, join a channel named "#channel" amd send a message "Ahoj lidi!" to that channel. And quit the server.


use console irc client

apt-get install ii
ii -i /tmp -s 192.168.1.2
echo "/PRIVMSG #teamchannel example.com: Alert! The server is rebooting now" > /tmp/irc/in

One solution would be to use expect to script communication with the IRC server using a telnet client.