How to force yourself to leave the computer using the leave command (#tilPost)

While browsing a collection of shell one-liners, I found out about a command that I haven’t seen before: leave.
The command is straightforward. Run it and define an absolute or relative time, and your terminal will remind you to lea…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

While browsing a collection of shell one-liners, I found out about a command that I haven't seen before: leave.

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.


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2020-11-19T23:00:00+00:00) How to force yourself to leave the computer using the leave command (#tilPost). Retrieved from https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/

MLA
" » How to force yourself to leave the computer using the leave command (#tilPost)." Stefan Judis | Sciencx - Thursday November 19, 2020, https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/
HARVARD
Stefan Judis | Sciencx Thursday November 19, 2020 » How to force yourself to leave the computer using the leave command (#tilPost)., viewed ,<https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » How to force yourself to leave the computer using the leave command (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/
CHICAGO
" » How to force yourself to leave the computer using the leave command (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/
IEEE
" » How to force yourself to leave the computer using the leave command (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/. [Accessed: ]
rf:citation
» How to force yourself to leave the computer using the leave command (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2020/11/19/how-to-force-yourself-to-leave-the-computer-using-the-leave-command-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.