4

In KDE, I find that if I echo something to pts/0:

me@mypc:~$ echo hello > /dev/pts/0

I get a message flash sent to myself.

I'd like to make a cron job to send similar messages to myself regularly. How can I do this?

P.S. I know that Ctrl+Alt+F7 switches to the GUI, but echoing to /dev/tty7 just gives me a permission denied error.

don_crissti
  • 82,805
cst1992
  • 165

3 Answers3

5

If you want to send a pop up message to a user logged into a Desktop Environment, have a look at notify-send.

cst1992
  • 165
Thomas
  • 6,362
2

xmessage is another way to spawn a window with text, which can work without notification daemons and can also have buttons.

Might be useful to someone, despite the facts it:

  • is ugly;
  • will spawn a tiling window in tiling window managers (I was actually searching for a way to fix that when I found this question);
  • does not work on wayland (obviously);
  • xmessage may be ugly, but unlike notify-send, it works from cron without messing about with environment variables, etc. It also runs on both Macs and Linux with zero hassle. It gets my vote! – Kevin Apr 11 '20 at 19:10
  • Correction: it turns out that if you run xmessage in a script called by cron, you DO have to put "export DISPLAY=:0" at the top of the script, but apart from that, xmessage is hassle-free. – Kevin Apr 12 '20 at 00:22
1

Are you looking for the write command? This command allows you to send a message to a given user, which is then printed on his terminal/console. You can optionally specify the tty to send the message to.

ph0t0nix
  • 1,147