How to Set Timers, Alarms, and Stop Watches in Ubuntu

In this article, we will explain how to set timers, alarms, and stopwatches on your Ubuntu system. The article explains the following two ways to do so:

  • Through the UI using the Gnome Clocks tool
  • Through the command line using various tricks and hacks

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTs system.

Through GNOME Clocks (GUI)

GNOME Clocks is a simple application to show the time and date in multiple locations and set alarms or timers. The software also includes a stopwatch. In this section, we will explain how to install and use Gnome Clocks.

Install GNOME Clocks

For a person who does not want to open the Command Line much, installing software present in the Ubuntu repository through the UI is very simple. On your Ubuntu desktop Activities toolbar/dock, click the Ubuntu Software icon.

Open Ubuntu Software Center

In the following view, click on the search icon and enter Gnome Clocks in the search bar. The search results will list the Gnome Clock entry as follows:

Search for Gnome Clocks in Software List

This package is developed by Canonical and maintained by the snap store. Click Gnome Clocks and the following view will appear:

Gnome Clocks package details

Click the Install button to begin the installation process. The following authentication dialog will display for you to provide your authentication details as only an authorized user can install software on Ubuntu. Authenticate yourself as administrator user

Enter your password and click the Authenticate button. After that, the installation process will begin, displaying a progress bar as follows.

Installing Gnome Clocks

Gnome Clocks will then be installed to your system and you will get the following message after a successful installation:

Launch the application

Through the above dialog, you can choose to directly launch the software and even Remove it immediately for whatever reason.

Launch GNOME Clocks

You can launch Gnome Clocks either by searching for it from the application launcher bar as follows or directly from the Applications menu:

Clocks Icon

In order to launch the tool through the command line, you need to enter the following command in the terminal:

$ gnome-terminal

The Gnome Clocks application opens in the World view by default.

Clocks application

Set an Alarm

Click on the Alarm tab and then the New button in order to set a new alarm. The following New Alarm dialog will appear as follows:

Set an Alarm

Through this dialog, you can:

  • Set the alarm time
  • Give a name to your alarm
  • Set the day(s) on which you want to repeat the alarm
  • Use the slider button to mark/unmark the alarm as Active

Once you have specified all the details, use the Done button in order to save the alarm. Once the alarm is saved, you can edit it any time by opening it from the alarms list in the Alarm view.

In order to delete an alarm, right-click on it; this will mark the alarm as selected. You can then delete it by clicking the Delete button located at the bottom right.

Use the Stopwatch

Click on the Stopwatch tab to open the Stopwatch view.

Through this view you can:

  • Start a stopwatch, through the Start button
  • Stop a Running stopwatch, through the Stop button
  • Marks laps on a running stopwatch by using the Lap button
  • Resume a stopped stopwatch, through the Continue button
  • Reset the stopwatch to 00:00 through the Reset button

Use the Stopwatch

Use the Timer

Click on the Timer tab in order to open the Timer view:

Use the Timer

You will see that the default time for the timer is set to 5 minutes. Through the Timer view, you can:

  • Set custom time for the timer
  • Start the timer through the Start button
  • Pause a running timer through the Pause button
  • Resume a paused timer through the Continue button
  • Reset the timer through the Reset button

Through Ubuntu command line-The Terminal

After thorough research, I could not find a single tool that would provide the timer, stopwatch and alarm functionality. However, following are some tools and tricks that would help you achieve your purpose.

You can open the Terminal either through the application launcher search or the Ctrl+alt+t shortcut.

Set Timer

Enter the following commands in order to install the timer utility:

$ curl -o ~/timer https://raw.githubusercontent.com/rlue/timer/master/bin/timer
$ sudo chmod +x ~/timer

Ubuntu timer command

Use the following command in order to get help on how you can use this utility:

$ ./timer -h

Timer command usage

For example, the following command will run the timer for 1 minute:

$ ./timer 1

The following command will set the timer for 10 seconds:

$ ./times -d 10

Use Terminal as a Stopwatch

This is a small hack that will turn your terminal into a stopwatch. Run the following command:

$ time cat

The command will not print anything till you terminate it. Once you terminate the command through the Ctrl+C shortcut, it will display the time duration between running and terminating the command as follows:

Set a stopwatch on the Ubuntu shell

You can use this elapsed time as a stopwatch in your terminal.

Set an Alarm from the Terminal

Okay so, here is another trick! You can easily use the sleep command to set an alarm on your system. This is how the sleep command works:

$ sleep 10m

Will make your terminal wait for 10 minutes.

$ sleep 10s

Will make your terminal wait for 10 seconds.

$ sleep 10h

Will make your terminal wait for 10 hours.

And,

$ sleep 10d

Will make your terminal wait for 10 days.

The terminal will execute the next prompt/ command after the sleep command ends. However, we usually want an alarm sound to be played as a wakeup call. How about incorporating the sleep command into a command that plays an alarm tone for you.

Step 1: Save an alarm tone as an mp3 file in your system

Step 2: Use the following command to wait/sleep for a specified time before playing your mp3 alarm tone

$ sleep [x]h [x]m && mplayer /path/to/file.mp3

For example:

$ sleep 4h && mplayer /Music/alarmtone.mp3

This command will play your alarm tone after 4 hours.

So these were a few ways in which you can use your Ubuntu system as an alarm clock, stopwatch, and a timer.


Source: How to Set Timers, Alarms, and Stop Watches in Ubuntu

%d bloggers like this: