Simple command line chat using netcat

 

If your linux machine doesn’t have netcat installed or nc command isn’t available, install netcat first. If you have already, skip this step.

sudo apt-get update
sudo apt-get install netcat

 

Assume you’re Piash and you’re the server. Now run this command in your terminal:

awk -W interactive '$0="\033[1;32mPiash: \033[0m"$0' | nc -l -p 1234

 

If Rupa is a client and wants to connect to the server, she has to run this:

awk -W interactive '$0="\033[1;34mRupa: \033[0m"$0' | nc <ip_of_server> 1234

<ip_of_server> : Server’s IP address. e.g. 192.168.0.104
1234 : Port number. Anything valid will do

 

Start chatting! Your chat screen should look like this:

From server terminal (Piash)
From client terminal (Rupa)

Leave a Reply

Your email address will not be published. Required fields are marked *