write a message to login users through terminal

March 10th, 2007 mysurface Posted in Admin, Common, wall, who, write | Hits: 283501 | 35 Comments »

To write a message to users that have login, you can using the command write. But before that, you need to check who is login, and which terminal he is login to, use command who.

Let say you was unable to call your friend, maybe he forgot to bring his cellphone and you know he is login to a linux server doing something, and you have permission to ssh to that particular server, then you can write him a message.

First, type:


who will list of all user have login and and login to which terminal, you will see something like pts/0, pts/1.

Example output:

aizatto    pts/0        2007-03-10 02:21 (:0.0)

With the information, now you can write messages to the user aizatto.

write aizatto pts/0

After typing the command line above, you can start to type your messages. When you hit enter, you message will be send to that terminal. Terminate the write by ctrl+D.

You can cat a file and pipe to write command too.

cat memo.txt | write aizatto pts/0

You can broadcast your message to all login user with wall command. wall, write to all.

cat announcement.txt | wall

Or simply type wall, then start to write your message. For wall, the message will be send only after you hit ctrl+D. And the message will be send to all users that login including you.

35 Responses to “write a message to login users through terminal”

  1. it will be nice if u can include some sample on how recipient screen look like when get the message.

    ( am i asking too much ? :P )

  2. login to s particular server through ssh, give me access as well, I will do you a live demo :P

    Its that better ? :D

  3. Not all distibution can have write i belive
    let’s assume to do it other way, through dev…

    echo msg > /dev/pts/1
    cat /dev/pst/1

  4. me gusto mas el último post, muy efectivo y sale inmediatamente en la termina. Tnks!!

  5. sebastian: I am sorry, I couldn’t understand the language you are saying.

  6. i am new to linux but i learned lots of neat stuffs already. is it possible to write message via terminal still yet the other side is not opening the terminal? thank you!

  7. jan:
    No, the user has to login to the console.

  8. example of what you see:

    Message from foo@server.domain on pts/1 at 10:23 …
    wanna grab lunch? im starved!!!

  9. if I will done for message and exit what must key word

  10. turn:

    “Terminate the write by ctrl+D.”

  11. I’m using Damn Small Linux and cannot use this command. It needs installing does anyone know where I can get the packages?

  12. Ricky:
    That is bsdmainutils package.

    bsdmainutils: /usr/bin/bsd-write

  13. Thanks for the quick reply;
    -bash: bsdmainutils:: command not found

    Shall I use apt-get instead?

    Update; I used apt-get install bsd-write. It trys to build the Dependency Tree it gets up to 5% and then it starts killing it and ending it.

    =] Thank you ever-so-much.

  14. Update: I got the apt-get working again and it cannot find the
    package. =] Thanks again.

  15. Ricky: Damn Small Linux uses apt-get? Oh that is new to me. May be you can try to

    apt-cache search write


    apt-cache search bsd

    or any other keywords you can think off.

    FYI, I am using Ubuntu, maybe the package’s name is different from Ubuntu repo.

  16. Thank you; Yeah I installed it onto the system. Thanks again. :)

  17. hello tableton,
    echo to /dev/… requires write permission to that file.
    It is necessary to give write permission to /dev/pts/.. to all users to use this method

  18. thank u

  19. BuTHileemeque Says:

    best search engine google

  20. anyone know how to view some sort of history log of messages you have received from other users?

  21. Want it? ,

  22. HI, Thanks a lot, I learned few things…

  23. Through wall command i can broadcast message on server, but i wants to know that how to send message on a particular IP.

  24. Hi I need to sent the user name and the tty from a file do you know how to do it?
    the file contain: user099 pts/0
    and I’m using:
    echo “Message”| write (here is when I need to read the data from the file)


  25. echo “jo” | write `cat file`

  26. i just want to know more about the command WALL
    just want to write on all user’s terminal ..
    i tried the command but it is asking for permissions

  27. Alu, Have to have perms for that program to run it, can’t broadcast a message without root privs I don’t think.. type man write and see… you can just do echo “wasssaaaa” |wall and that will broadcast the message wasssaaaa to everyone logged in.. If you want to chat them try using ytalk and the username ie: ytalk test

  28. nice post

  29. how to find.. who sent the broadcast message ?

  30. How do you send “clear” to the other user after the transmission has eneded?

  31. [...] example from Linux by Examples might [...]

  32. [...] write-a-message-to-login-users-through-terminal [...]

  33. Matematyka z plusem sprawdzian

  34. Hi there, I would like to subscribe for this web site to get hottest updates, so where can i do it please assist.

  35. sshed a system and i want to write on his terminal which he is using

Leave a Reply