Mastering Taskwarrior

Task Master

Article from Issue 158/2014
Author(s):

Taskwarrior is arguably the most powerful command-line task manager. We show you how to use this application to manage tasks like a pro.

When it comes to command-line task managers, Linux users are spoiled for choice: Literally dozens of CLI-based tools have been built for keeping tabs on tasks and to-dos. Only a few of them, however, can rival Taskwarrior [1] in terms of functionality and flexibility. This task management tool boasts an impressive feature set that caters to power users. Although you can come to grips with Taskwarrior's functionality in a matter of minutes, mastering its more advanced features may require some time and effort. In this article, I will help you along the way.

Installing and Configuring Taskwarrior

As a mature and popular project, Taskwarrior has made it to the software repositories of many popular Linux distributions, which means you can install the application using your distro's default package manager. On Debian and Ubuntu, Taskwarrior can be installed by running the

apt-get install task

command as root.

The official software repositories often contain older version of Taskwarrior, and if you want to deploy the most recent release of the application, you have to compile it from source. Fortunately, the process is relatively simple. Grab the latest release of Taskwarrior from the project's website, unpack the downloaded tarball, open the terminal, and switch to the resulting directory. Before you can compile Taskwarrior, you need to install the required software. To do this on Debian and Ubuntu, use the following command:

apt-get install build-essential cmake

Now you can compile and install Taskwarrior:

cmake .
make
make install

Note that you need to run the last command as root. By default, Taskwarrior is installed in the /usr/local/bin directory. If this directory is not in your path, you have to add it manually. Assuming that you are using Bash, open the .bashrc file in a text editor and add the line:

export PATH=$PATH:/usr/local/bin

Save the changes, restart the terminal, and run the command

task --version

which should return the version of Taskwarrior installed on your system.

Once Taskwarrior has been installed, you might want to tweak its basic settings. All Taskwarrior's settings are stored in the ~/.taskrc file, but you don't have to edit it directly. Instead, you can run the task show command to view all available settings and then use the task config command to modify a specific entry. For example, the weekstart option in the default configuration is set to sunday. To change it to monday, run the task config weekstart monday command. Taskwarrior relies on the vi editor for working with tasks. If you prefer to use another text editor, you should specify it by configuring the editor setting. For example, you can use the task config editor nano command to set nano as the default editor.

Mastering Taskwarrior

To get started with Taskwarrior, you just need to know a few simple commands. Obviously, the first thing to do is to populate Taskwarrior with tasks, and the task add command lets you do just that. Type task add, followed by a short description of the task, and then press Enter to add the task; for example:

task add Read a book

The next important action is to view the tasks added to Taskwarrior, and the application offers several commands for doing so. The task ls command generates a concise list, which gives you a quick overview of the key aspects of each task, including its ID, priority, and description. For more detailed info, use the task long command, which also shows the countdown, age, and tags for each task. To view the full info of a specific task, use task <ID> info (replace <ID> with the actual ID of the task).

As you might have figured out, Taskwarrior lets you assign a priority, tags, and a project to each task. The priority parameter lets you specify a priority when adding a task:

task add priority:H Learn Japanese

The priority parameter accepts three values: H (high), M (medium), and L (low). To manage related tasks more efficiently, Taskwarrior lets you group them into projects. For example, if you are working on a book, you can add all book-related tasks to the Book project. To assign a project to a task, use the project parameter as follows:

task add project:book Finish Chapter 1
task add project:book Proofread Chapter 2

To list all projects in Taskwarrior, use the task projects command. The report displays the total number of tasks in each project along with the number of tasks for each priority level (Figure 1). You can also view all tasks in a specific project using the task list pro command:

task list pro:Book
Figure 1: Taskwarrior in action.

Tagging is a de rigueur feature of a task manager, and Taskwarrior provides an easy way to assign multiple tags to a task. When creating a task, append the desired tags to the task add command as follows:

task add +japanese +language Learn Japanese

To view tasks containing a certain tag, use the task list command followed by the tag:

task list +japanese

Taskwarrior also makes it possible to add notes to a task using the task <ID> annotate command; for example:

task 1 annotate Start with learning basic phrases

You can append as many annotations to a task as you need. Taskwarrior lets you assign due dates to tasks using the task due command. In addition to the standard date and time format, the command supports other ways to specify deadlines, such as 3days (3 days from now), 3wks (3 weeks from now), monday (the coming Monday), eow (end of the current week), 17th (the 17th of the current month), eom (end of the current month).

Taskwarrior also lets you mark tasks as active. This feature can come in handy when you need to keep track of tasks you are currently working on. To mark a task as active, use task <ID> start. Now, if you run any of the task reporting commands (e.g., task long), you will notice that all active tasks are highlighted, which makes it easier to identify them. Alternatively, you can use task active to list only active tasks. The task <ID> stop command stops a specific active task, whereas task <ID> done marks the task as finished.

Taskwarrior provides commands for editing and deleting tasks, too. The task <ID> edit command opens a task in the default text editor, so you can manually edit the task's properties. And if you want to completely remove a task, you can do this using the task <ID> delete command.

Instead of editing tasks in the default editor, you can use task <ID> modify to modify a certain property of a specific task. For example, to set a priority of task 5 to High, use the task 5 modify priority:H command. If you need to assign the travel tag to task 7, you can run the task 7 modify +travel command. The task 7 modify -travel command, in turn, removes the specified tag. The clever part is that Taskwarrior lets you modify multiple tasks in one go. For example, the task 1-5 modify priority:L command sets the priority of tasks 1 to 5 to Low, whereas task 1-5,7,9 modify +language adds the language tag to tasks 1 through 5, as well as to tasks 7 and 9.

Other Useful Commands

The commands covered so far should be enough to get you started, but Taskwarrior offers other useful functionality, too. For example, the application can handle recurring tasks, and you can use the due and recur parameters to specify recurrence; for example:

task add due:eom recur:monthly Pay bills

Using the until parameter, you can also specify the end of the recurrence period:

task add due:eom recur:monthly until:eoy Renew magazine subscriptions

Taskwarrior also allows you to define dependencies between tasks, which can be rather useful for managing complex projects:

task add depends:1 Travel to Japan

The command above adds a new task that depends on task 1 (in this case, task 1 could be "Learn Japanese"), and the newly created task will be blocked until task 1 is marked as completed. To view a list of all blocked tasks, use the task blocked command.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News