How to Use the Linux CLI as a Stopwatch

Several vendors have developed stopwatch software, which can be useful for keeping track of things. Timing is very important in several types of tasks. System administrators might need a stopwatch in order to time the booting of a computer or the execution of a certain task. You may wish to do this yourself if you’re currently working on optimizing something. Of course, stopwatches are extremely useful outside of the IT world as well. You might want to use a piece of stopwatch software in a classroom or to time a sporting event.

With a simple but not commonly known Linux CLI trick, you can actually circumvent the necessity of installing any such software. A single command is enough to turn a graphical terminal emulator into a functioning stopwatch.

Using the CLI Stopwatch

Open up a graphical terminal from the Applications menu or hold down CTRL, ALT and T at the same time to do so. You could theoretically do this in a virtual console as well, by holding down CTRL, ALT and F1-F6 then logging in. Once you’re at a prompt type time read. As soon as you push enter, your CLI interface will begin counting. Hold down CTRL and D to make it stop and return the amount of time it counted. Since this command only counts genuine real time and not system or user execution time, this technique will only output valid data in the “real” field. In the example screenshot, we had decided to time how fast the e4defrag command could defragment an entire user’s home directory. It ran in a smoking 26.423 seconds according to the time read command. If you had needed to time something in a length of minutes, the first value before “m” would read a non-zero number.

picture-a

Functionally this means that time read plus return is like hitting the button on the top of a discrete stopwatch in real life the first time and pushing CTRL and D at the same time is like hitting it a second time.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Use the Linux CLI as a Stopwatch

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested