How to force yourself to leave the computer using the leave command
- Published at
- Updated at
- Reading time
While browsing a collection of shell one-liners, I found out about a command that I haven't seen before:
The command is straightforward. Run it and define an absolute or relative time, and your terminal will remind you to leave it alone and go at a certain time.
# set the alarm for 2:10pm $ leave 1410 Alarm set for Fri Nov 20 14:10:00 CET 2020. (pid 3121) # set the alarm in two minutes $ leave +2 # set the alarm in two minutes interactively $ leave When do you have to leave? +2 Alarm set for Fri Nov 20 09:05:21 CET 2020. (pid 50717)
When the time arrives, the command running in the background sends shell notifications and prints new lines telling you to go. And let me tell you the best part: it doesn't do that once; it does that repeatedly every minute after the set alarm time. It will try hard to make you leave!
You can only stop the running
leave process from annoying you by logging out of your shell session (or manually stopping the process). 😆
I love that! Maybe I should define
leave 1900 in my
.zshrc to force me to stop doing nerdy things late at night.
Edited: For the adventurous folks – Frederic Hemberger pointed out that you could also just shut down the system at a specific time using
sudo shutdown -h 12:00 "Feierabend!". But be careful with this command; it could lead to data loss. 😆
If you're interested in reading comments and alternatives to the
leave command, this post was trending on Hacker News.