How to set Timers, Alarms, and Stopwatches on CentOS 8

In this article, I will show you how to set timers, alarms, and stopwatches on your CentOS 8 system. We will perform these actions using two different ways. Using:

  • The graphical user interface
  • The terminal

On the GUI, we will use the GNOME Clocks Utility, on the command line, we will use the timer and sleep command.

Using Gnome Clocks Utility

Gnome Clocks is a utility that facilitates the user to show the date and time of various locations. Using this utility, users can set alarms and use stopwatch in a single application.

Here, we will demonstrate that if this utility is not already installed on your system then how you can install and use it on your system CentOS 8.

How to install Gnome Clocks on CentOS 8

GNOME Clock

Gnome Clocks application is present in the CentOS 8 repository. You can directly install it using GUI.  Click on Activities and type ‘Gnome Clocks’ in the application search bar or you can also find this utility directly to go into the Software’s. From the search results list, you will select Gnome Clocks and click on it. The following screen will appear:

Here, you will click on the ‘install’ button to start the installation process. As you will see that the installation progress bar is displayed as follows:

GNOME Clocks on CentOS

Installing GNOME Clocks After completing the installation process, the following screen will display on your desktop:

Using the above dialog options, you can directly launch the Gnome Clocks or if you want to uninstall it for any reason then you can remove it as follows:

Launch GNOME Clocks

Launch Gnome Clocks

Launch Gnome Clocks You will launch the Gnome Clocks by typing it in the application launcher search bar as follows:

You can also launch this tool using the command line by executing the following command:

$ gnome-clocks

When Gnome Clocks will open on your CentOS 8 system the following window will be displayed. You can add the world clock according to your location and time zone as follows:

Add new world clock

World Clock

Set an Alarm

In the next tab of the Gnome Clocks window, click on the ‘Alarm’ tab. Here, you can add a new alarm by clicking on the ‘Add Alarm’ button as follows:

Add Alarm

 

Now, you need to adjust the following option in the dialog box:

  • Set the time of the alarm
  • Set day(s) to repeat the alarm these days
  • It is optional that you can give a name to the new set alarm

Once you have completed all the alarm information, click on the ‘Add’ button to set this alarm as follows:

Schedule Alarm

Once you saved the alarm, you can also edit from the alarm list of the edit option.

Alarm has been scheduled

Similarly, you can also delete an alarm from the remove alarm or delete option as follows:

Adjust Alarm time

Use Stopwatch on CentOS 8

Click on the stopwatch tab. You will see the following view:

Stopwatch

Here, you can perform the following actions:

Click on the start button to run a stopwatch. Using the lap button, count laps on a running stopwatch as follows:

Start a Stopwatch

Continue a stopped stopwatch, use the Resume button and if you want to reset the stopwatch then you will use the ‘Clear’ button as follows:

resume Stopwatch

Use a Timer on CentOS 8

Click on the ‘Timer’ tab to open timer view as follows:

Start a timer

Here, you can select the duration of the timer. Click on the start button to start the timer and pause button to stop the running timer.

Timer is running

Using the command line or terminal

You can set alarms, timers, and stopwatch executing the below-mentioned commands on the terminal. These commands are almost similar to all Linux distributions. Here, we are implementing on CentOS 8.

Open the terminal using Ctrl + Alt + t shortcut method.

Set Timer on the Commandline

To install timer utility type the following command:

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

Run a timer on the shell

To get the help related to the timer run the below-given command:

$ ./timer –h

Timer options

For example, you will use the following command to set the timer for 10 seconds:

$ ./timer -d 10

To set time for 1 minute using the following command:

$ ./timer 1

Run stopwatch using terminal

To run stopwatch using the terminal execute the following command on the terminal:

$ time cat

After executing the above command, nothing will print on the terminal. When you will terminate the terminal using Ctrl +C shortcut keys. After that, you will see that duration of time between the running and termination has been displayed as follows:

Timer

Set Alarm using terminal

To set the alarm using the terminal you will perform the following steps:

  1.  First, you will save an alarm as an mp3 file.
  2. Execute the following command to set sleep time before playing your mp3 alarm.

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

For example, you want to play an alarm after 4 hours.

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

$ sleep 10m –use this terminal command wait for 10 minutes

$ sleep 10s –wait terminal for 10 seconds

$ sleep 10h –wait terminal for 10 hours

$ sleep 10d – wait terminal for 10 days

Conclusion

In this article, you have learned how to set alarms, timers, and stopwatch using GUI as well as the Command line. I hope this article would be useful for you. Furthermore, you can explore more terminal commands. Please give us your feedback in case of any problem via comments in the comment box.