The timer command in Linux

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. Lately, part of the community has been dedicated to creating tools that are an improvement to commands that already exist in Linux. Today, in this post, you will learn about the timer command in Linux.

A brief introduction to Timer

The Timer command is a creation of a developer named “Carlos Alexandro” who wanted to share with the community his project.

It is the timer command that in the description of the tool’s profile on GitHub defines itself as

Timer is a small CLI, similar to the sleep everyone already knows and love, with a couple of extra features.

In other words, a sleep but with a progress bar.

Besides this, we also have other additional features like

  • A progress bar indicating the progression of said timer
  • A timer showing how much time is left
  • Named timers

And as expected, the installation on Linux is basic and the methods are quite varied.

Let’s go for it.

Installing the time command in Linux

We have many ways to install Time on Linux. Too many. The easiest and most immediate are downloading the DEB and RPM packages according to your distribution.

To download the DEB package, you can use wget.

wget https://github.com/caarlos0/timer/releases/download/v1.1.0/timer_1.1.0_amd64.deb

And then install it on your favorite distro.

sudo apt install ./timer_1.1.0_amd64.deb

About the RPM package, you can run

wget https://github.com/caarlos0/timer/releases/download/v1.1.0/timer-1.1.0.x86_64.rpm

And then install it using

sudo rpm -i timer-1.1.0.x86_64.rpm

Furthermore, if you have Homebrew installed, you can simply run

brew install caarlos0/tap/timer

Anyway, there are more instructions on the tool’s GitHub site.

Using the timer command in Linux

The use of this command is similar to the sleep command. We must remember that the sleep command allows us to set a time before executing a task.

The basic syntax is as follows

timer <duration>

Or

timer -n <name> <duration>

Although you can also get additional information by running

timer --help

Or

man timer

An example of how to use it would be

timer 15s
1.- The timer command in Linux
1.- The timer command in Linux

In this case, it will count down from 15 seconds to the end. The time units are seconds (default), minutes (m), hours (h) and days (d).

The most useful of this tool is when combined with another task. For example:

timer 0.1m; cd Downloads/
2.- Using the timer command
2.- Using the timer command

And that’s how easy it is to use it.

Conclusion

Timer is a basic command, but in scripts it can be very useful because of its progress bar.

I hope this simple post has helped you.

Also read: How to record terminal sessions

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook