In this article, we will explain how to set timers, alarms, and stopwatches on your Debian system. We will explain 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 Debian 10 Buster 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 Gnome Clocks if it is already not available on your system. Then, we will tell you how you can use the utility.
Install GNOME Clocks
For a person who does not want to open the Command Line much, installing software present in the Debian repository through the UI is very simple. On your Debian desktop Activities toolbar/dock, click the Software icon.
In the Software utility, click on the search icon and enter Gnome Clocks in the search bar. The search results will list the Gnome Clock entry as follows:
This package is developed and maintained by Debian Stable Main repository.
Click Gnome Clocks and the following view will appear:
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 Debian.
Enter your password and click the Authenticate button. After that, the installation process will begin, displaying a progress bar as follows.
Gnome Clocks will then be installed to your system and you will get the following message after a successful installation:
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:
In order to launch the tool through the command line, you need to enter the following command in the terminal:
The Gnome Clocks application opens in the World view by default.
Set an Alarm
Click on the Alarm tab and then the New button in order to set a new alarm. The following New Alarm will appear as follows:
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
- Mark laps on a running stopwatch by using the Lap button
- Continue a stopped stopwatch, through the Continue button
- Reset the stopwatch to 00:00 through the Reset button
Use the Timer
Click on the Timer tab in order to open the Time view:
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 the Debian 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 through the application launcher search.
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
Use the following command in order to get help on how you can use this utility:
$ ./timer -h
For example, the following command will run the timer for 1 minute:
$ ./timer 1
The following command will set the timer for 10 seconds:
$ ./timer -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:
You can use this time-lapse 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 to 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
$ 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
$ 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 Debian system as an alarm clock, stopwatch, and a timer.