MacOS Command Line Tip>

If you kicked off a job and it turns out it’s going to take a lot longer than you thought, and you don’t want to throw away your progress:

^Z
$ fg; say done

This will pause your program, then resume it, but this time you’ll get an audible notification when it completes. Unblock thyself.

The semicolon is important because it’s analogous to a finally block. You’ll get a notification for either success or failure. You can also && say yay || say oh no.

Follow

@kriskowal This should also work the same on a typical Linux terminal, I believe?

· · Web · 1 · 0 · 0

@joepie91 It’s been a long while since Linux was my daily driver and I expect there is an analogue to `say` there now, but I don’t know about it yet. Pray share.

@joepie91 Way back, I would have used mpg123 for the same effect, though.

Similarly, I used to recommend jot for Mac as a stand-in for seq, but seq is now ubiquitous, thankfully.

Similarly, I enjoy pointing Linux folks at xclip -i and xclip for their analogue for Mac’s pbcopy and pbpaste.

@kriskowal Ah, oops, I was only thinking of the ^Z and fg part, not the `say` part 😅

I think probably the closest `say` equivalent on Linux would be `espeak-ng`? That does usually require separate installation. Or alternatively `notify-send` for displaying a notification (which I believe is preinstalled on a lot of distros).

Sign in to participate in the conversation
Pixietown

Small server part of the pixie.town infrastructure. Registration is closed.