How to Set an Alarm on Ubuntu?

How to Set an Alarm on Ubuntu?

Updated: November 18, 2020

Sometimes, you may need to set an alarm on your Ubuntu desktop. Although Ubuntu comes with lots of applications by default, it does not come with an alarm clock like Windows.

On the other hand, you can install many applications using the Ubuntu Software Center. The Ubuntu Software Center helps Ubuntu users to find and install any software they need. The good news is, there is an Ubuntu alarm clock application that you can install available there.

How to Install an Alarm Clock for Ubuntu?

To install an alarm clock for Ubuntu, follow the steps below:

  • Open Ubuntu Software Center
  • Type alarm
  • Click to Alarm Clock (alarm-clock-applet)
  • Click Install

Alternatively, you can also install the alarm clock application via the terminal. To do that, open the terminal on your computer and type in the following command:

$ sudo apt install alarm-clock-applet

How to Set an Alarm on Ubuntu Desktop?

After installing the alarm clock applet, launch it. Then, to set an alarm, follow the steps below:

  • Click on the plus icon
  • Set the time and choose the sound
  • After adding the alarm, click on the tick icon

Alternatively, you can use an online alarm clock to set an alarm. This way, you can set an alarm on Linux, regardless of the Linux distribution you are using.

How to Use the Terminal as an Alarm Clock?

You can use your terminal as an alarm clock as well. To do that, use the sleep command. /bin/sleep delays the execution of the next shell command for a specified amount of time.

Below is the syntax for the sleep command:

sleep NUMBER[SUFFIX]

SUFFIX may be any of the below:

  • s for seconds (the default)
  • m for minutes
  • h for hours
  • d for days

For instance, the command below will pause the execution of the next shell command for seven hours and thirty minutes:

$ sleep 7h 30m

Since NUMBER may be an arbitrary floating-point number, you can also execute the same command like below:

$ sleep 7.5h

To play audio after the sleep command is over, you can use the AND operator like below:

$ sleep 7h && mplayer --vo=null /path/to/alarm-tone.mp3