little linux helpers (4)

April 23, 2013 — Leave a comment

if you want to know who is currently logged into the system and what they are doing, just type “w”:

/usr/bin/w
[root@xxxxxx ~]# w
 18:08:06 up  3:58,  5 users,  load average: 0.14, 0.05, 0.02
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     -                17:18   50:04   0.04s  0.04s -bash
root     pts/0    10.0.2.2         18:05    0.00s  0.05s  0.00s w
test1    pts/2    10.0.2.2         18:07    1.00s  0.03s  0.03s -bash
test2    pts/3    10.0.2.2         18:07    4.00s  0.06s  0.01s ping localhost
test3    pts/4    10.0.2.2         18:07   28.00s  0.09s  0.05s vim

… and to have some fun: if you want to send a message to e.g. the test1 user:

echo "i'll be watching you" >> /dev/pts/2

this will print the message on the test1 user’s screen:

[test1@xxxxxx ~]$ i'll be watching you

No Comments

Be the first to start the conversation!

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.