Skip to main content

Tracking time with Timewarrior at the command line

See how this great Linux time tracking software helps sysadmins manage tasks and resource allocation.
Image
Tracking time with Timewarrior at the command line
Image by Willgard Krause from Pixabay

Timewarrior is an open source tool that tracks time from the command line. And in this article, I show you how it comes in handy.

My guess is that many sysadmins share the need to spend a specific amount of time on certain projects. For example, let's say I have a contract to work 40 hours a week doing virtualization and cloud computing stuff for 50% of the time, spending 30% of the time on Linux, and another 20% on firewall and load-balancing. Well, that's the plan, at least. To see how this plays out in reality, I need a tool to track my time on these tasks. The tool has to be quick and easy to use, so I don't waste time tracking instead of working.

Prepare the stage for Timewarrior - a tool that I feel is of so much help that I wish I had known it far earlier.

Looking for the full documentation? You'll find it at the Timewarrior web site.

Possible use cases

Nothing is as helpful as some real-world use cases. I'll show you some of mine.

As simple as a stopwatch

To record some random activity, you could use Timewarrior as a simple stopwatch. As you begin the activity, you start the clock:

$ timew start
Tracking
Started 2020-08-19T08:18:23
Current 23
Total 0:00:00
$ timew stop
Recorded
Started 2020-08-19T08:18:23
Ended 20:49
Total 0:02:26

When you're finished with the activity, stop the clock and find the time spent printed to stdout.

[ Readers also enjoyed: Linux sysadmin basics: User account management ]

Track reoccurring activities using tags

To track time spent on activities like Meetings, Linux, or Firewall, I use tags which I append to the timew start command. Please look at the following code blocks carefully to understand how this works.

Start the Meeting:

$ timew start Meeting
Tracking Meeting
Started 2020-08-21T10:56:24
Current 24
Total 0:00:00

Start the Virtualization task:

$ timew start Virtualization
Recorded Meeting
Started 2020-08-21T10:56:24
Ended 57:19
Total 0:00:55
Tracking Virtualization
Started 2020-08-21T10:57:19
Current 19
Total 0:00:00

Start Meeting:

$ timew start Meeting
Recorded Virtualization
Started 2020-08-21T10:57:19
Ended 58
Total 0:00:39
Tracking Meeting
Started 2020-08-21T10:57:58
Current 58
Total 0:00:00

Start Linux:

$ timew start Linux
Recorded Meeting
Started 2020-08-21T10:57:58
Ended 58:35
Total 0:00:37
Tracking Linux
Started 2020-08-21T10:58:35
Current 35
Total 0:00:00

Stop tasks:

$ timew stop
Recorded Linux
Started 2020-08-21T10:58:35
Ended 11:00:25
Total 0:01:50

Display the summary:

$ timew summary
Wk Date Day Tags Start End Time Total
W34 2020-08-21 Fri Verw. 6:41:58 6:43:16 0:01:18
Virtualization 6:43:16 6:48:05 0:04:49
Sysmaster 6:48:05 6:50:44 0:02:39
Meeting 10:56:24 10:57:19 0:00:55
Virtualization 10:57:19 10:57:58 0:00:39
Meeting 10:57:58 10:58:35 0:00:37
Linux 10:58:35 11:00:25 0:01:50 0:12:47

Depending on your terminal settings the output looks much nicer as the screenshot from a gnome-terminal should illustrate.

Image
time warrior output

With timew summary, you get the summary for your current day. As you see, I worked in the early morning today, which I had almost forgotten already.

Would you like to know more about Timewarrior's reporting functionality? Look at the documentation.

[ Free cheat sheet: IT job interview tips

Wrap up

Timewarrior is an awesome tool that helps me track time spent on different projects quickly and easily. This information helps to determine whether one person's time is enough to deal with all the work for one task or if more resources are needed to get the job done.

Topics:   Linux   Career  
Author’s photo

Jörg Kastning

Jörg has been a Sysadmin for over ten years now. His fields of operation include Virtualization (VMware), Linux System Administration and Automation (RHEL), Firewalling (Forcepoint), and Loadbalancing (F5). More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.