Message on Linux terminal


Few interesting commands which can be used to send the messages on other terminal or network:

1. wall:

This command is used to broadcast a message on all terminals.

For e.g.:

wall "Hello, message testing"

or

cat msg.txt | wall

2. write:

This command is used to send message to a user & selected terminal of a user.

For e.g.:

echo "Hello, message testing" | write rahul

or

echo "Hello, message testing" | write rahul pts/0

or

cat msg.txt | write rahul pts/0

or

write rahul pts/0 << EOF
Hello, message testing
EOF

3. echo:

echo command can also used to send messages on selected terminal.

For e.g.:

echo "Hello, message testing" > /dev/pts/0

4. cat:

cat can also write on a selected terminal similar to echo command.

For e.g.:

cat /dev/pts/0
Hello, message testing
CTRL+D

5. notify-send:

It can send the desktop notifications.

For e.g.: From gnome terminal,

notify-send "Hello, message testing"

From any terminal

export DISPLAY=:0 && notify-send "Hello, message testing"

From SSH,

ssh <host> export DISPLAY=:0 && notify-send "Hello, message testing"
Advertisements

6 thoughts on “Message on Linux terminal

  1. Pingback: Send Message on Linux Terminal « CATATAN MAS BLACK !

  2. To use the command write, the user you’re writing to must allow other users to write on his terminal using the mesg command, like :
    mesg y <– if you want to allow messages
    mesg n
    simply type :
    mesg
    to have the current state.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s