Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to know that how we can chat between 2 ubuntu machines in a network.

there are many messengers but we are prohibited from using those who send the files.

any command line chat messenger for 2 ubuntu in network? or GUI will also work.

share|improve this question
    
Prohibited by who? ...and what does chat has to do with sending files? –  mikewhatever Apr 12 '12 at 4:16
    
its about company policy & so I wanted to use messenger which will chat between two ubuntu machines easily –  sam Apr 12 '12 at 4:18
    
sam: then my answer is the best one. No doubt. You'll just use your normal IM application. –  Jo-Erlend Schinstad Apr 12 '12 at 19:59

4 Answers 4

up vote 5 down vote accepted

The simplest way I can think would be using netcat

try this on your own machine in one terminal:

netcat 8080 -l

(this will be the server since we used -l to set it in listen mode)

in the other terminal:

netcat localhost 8080

(this will be the client connecting to the server)

try typing in one of the windows. You can select any port you want for client / server, but privileged ports (below 1024) require root access on the server)

Replace localhost, on the client, with the ip / dns name of the sever you want to connect to if you want to try this over a network

share|improve this answer

Probably not what you're looking for, but you can just ssh in to limited accounts on each others machines and use wall.

enter image description here

share|improve this answer
    
Even better, skip the echo part and use wall. Then type the message and press Enter. –  Lekensteyn Apr 12 '12 at 9:10

@tomodachi suggested using netcat. That is a nice idea, but the disadvantage of a simple nc -l -p 1234 and nc ip.ad.dr.ess 1234 is that text that is being typed gets overwritten by the received messages. Note that by "netcat", I refer to the traditional "swiss army knife" netcat, not the BSD one. netcat-traditional is not installed by default, so do so. You then might want to change the default netcat program using sudo update-alternatives --config netcat.

The basics of netcat is that you open a port that can receive a single TCP connection. When data is received, it's printed to standard output. Standard input gets sent to the other side. In a terminal, standard input and standard output are often displayed in one terminal which makes it possible for the data to get mixed up. For example, when you begin to type "hello", if you receive in meantime a message, the terminal could show "helMESSAGElo" even if you are really sending "hello" to the other side.

By splitting opening two terminal tabs and split the view horizontally, you have can show two different shells simultaneously in one window.

  1. Open another tab (Ctrl + Shift + T or File > New tab)
  2. Split the tabs. In Konsole (KDE), this can be done in the View > Split views menu, Split views horizontally.
  3. Run tty in the upper tab, it outputs the filename which represents the current shell. Below, I assume that this output is /dev/pts/2 for host Alice and /dev/pts/4 for the second guy, Bob. Adjust if necessary
  4. Make sure that two different tabs are shown if not already.
  5. I've chosen the below tab for entering text to be sent, so focus that one.

Until now, the steps that had to be executed were the same for both sides of the communication. Now, it gets slightly different.

  1. As "the server" or "the host", start listening on port 1234 (adjust to your own preferences):

    cat /dev/pts/2 | nc -l -p 1234 > /dev/pts/2
    

    The other guy "Bob" should connect to your IP (10.2.3.4 below) on port 1234.

    cat /dev/pts/4 | nc 10.2.3.4 1234 > /dev/pts/4
    
  2. The communication can start! Type your message followed by Enter. To abort the session, you can simply close the tabs or window. Alternatively, press Ctrl + C in the command window (the below tab).

Screenshots for the host and receiver side:

Alice Bob

share|improve this answer

Use Bonjour. It is also known as Link-Local XMPP. It's supported by Telepathy/Empathy and others, like Pidgin. The others do need to switch it on in their clients, but there's no need for any servers or anything like that. It works like normal XMPP, so you can send files, use webcam, etc, too.

In Ubuntu, this is called "People nearby". You add it like any other IM account and it works the same way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.