Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to use notify-send to send messages to other users on the system?
preferably to a specified user, but system wide would work aswell.

Ubuntu/Debian with libnotify installed

share|improve this question
up vote 3 down vote accepted

If you have the other users password you can do sudo -u somedude notify-send Hello. somedude must have an X-session started.

Edit: Found this script for use with cron:

export DISPLAY=:0.0
export $(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -session)/environ )
/usr/bin/notify-send -t 36000 $1 $2
share|improve this answer
with slight modification, that script does what i need it to do, thanks – madmaze Oct 5 '11 at 16:49

If the users are on terminals the following commands will be of use -

write user [tty]

or to send to all users

share|improve this answer

I stumbled upon the following project that implements a user notify: tinynotify-send

share|improve this answer

I needed similar tool to send notification to all sessions. Here is my solution:

It scans /proc to find all session busses and then it executes notify-send on each of it (once per bus). All arguments are passed unchanged to real notify-send.


/bin/grep -sozZe '^DBUS_SESSION_BUS_ADDRESS=[a-zA-Z0-9:=,/-]*$' /proc/*/environ \
| /usr/bin/php -r '
        $busses = array();
        while($ln = fgets(STDIN)) {
                list($f, $env) = explode("\0", $ln, 2);
                if (file_exists($f)) {
                        $user = fileowner($f);
                        $busses[$user][trim($env)] = true;
        foreach ($busses as $user => $user_busses) {
                foreach ($user_busses as $env => $true) {
                        if (pcntl_fork()) {
                                $env_array = array("DBUS_SESSION_BUS_ADDRESS" => preg_replace("/^DBUS_SESSION_BUS_ADDRESS=/", "", $env));
                                pcntl_exec("/usr/bin/notify-send", $argv, $env_array);
' -- "$@"
share|improve this answer

Your Answer


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.