Setting an alarm on Linux can be helpful to remind you of something or act as a timer. It might also come in handy if you take a little snooze at your desk. In this tutorial, we will show you how to set an alarm on Linux via command line and GUI.
In this tutorial you will learn:
- How to set alarm via command line
- How to install GNOME clocks
- How to install
- How to configure alarm via GUI
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||sleep, at, GNOME Clocks|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Set alarm via command line
There is not a readily available command that can be used specifically to set an alarm, so we will need to get a little creative. Take a look at some examples below to see how a makeshift alarm can be set from the command line on Linux.
Set alarm via sleep command
The best option is going to be the
sleep command, which is available by default on all Linux distros. This command allows us to pause a terminal action for any amount of time specified in seconds, minutes, hours, or days.
To really match the same experience as an alarm, you could download an alarm sound (like an .mp3 file) and have it play when the
sleep command finishes its timer. Here is an example where VLC media player would open
alarm.mp3 after 8 hours.
$ sleep 8h && vlc alarm.mp3
Alarm for 45 minutes:
$ sleep 45m vlc alarm.mp3
Alarm for 30 seconds:
$ sleep 30s vlc alarm.mp3
Set alarm via at command
For setting alarms at a specific time, you could use the at command. It is not ordinarilly installed by default.
You can use the appropriate command below to install
at with your system’s package manager.
$ sudo apt install at
$ sudo dnf install at
$ sudo pacman -S at
After installation, you can use
at to run a command at a specified time. Set
at to play your
alarm.mp3 file or do a similar action to get your attention at the desired time.
Set alarm for tomorrow at 8 AM:
$ at 8:00 tomorrow warning: commands will be executed using /bin/sh at Sun Mar 20 08:00:00 2022 at> vlc alarm.mp3 at> <EOT> job 1 at Sun Mar 20 08:00:00 2022
Ctrl + D to save and confirm the
at setting, or
Ctrl + Z to exit and cancel.
You can view your configured alarms with:
$ at -l 1 Sun Mar 20 08:00:00 2022 a linuxconfig
Set alarm via GUI
There are various GUI programs available that will allow us to configure alarms. It would be unusual to have one installed by default, but it may be worth checking – just do a search in your desktop’s application launcher for “alarm.”
Most likely, you will need to download a third party program to configure an alarm clock via GUI. On our Ubuntu test system, we opted for “GNOME Clocks.” You can find it for installation in the Software Center application in just a few seconds:
After installation, open up the app, click on the Alarms tab, and then select Add Alarm. Use the interface to pick a date and time, and GNOME Clocks will alert you like a typical alarm clock.
In this tutorial, we saw how to configure an alarm clock on Linux via command line and GUI. Since there is no command specifically for alarm clocks, we have to create makeshift alarms with
at. However, there are lots of options availale in third party applications if you are using a desktop environment GUI like GNOME.