I have used many GUI task managers on Linux before, and gnote was my favorite, because it was simple, easy to use and had all that I needed to keep track of my tasks and nothing more. Now, there is a new favorite on the block. Most importantly, it is controlled via the command line… sweet :)
The app in question is called Task Warrior. It is super simple to use, has tons of features and is just plain beautiful. You can install task warrior in Ubuntu with the following command
$ sudo apt-get install task
The following are CLI commands for task warrior for some of the most common usage scenarios. It is recommended that you go through all the examples below even though you would not need to use most of them all the time.
List all pending tasks
$ task long
The subcommand long gives you a long listing(all attributes) of pending task. You could have used “ls” or “list” instead of “long” to give a more concise report with fewer columns(attributes). These however do not report tasks that have been completed. If you want to see completed tasks along with pending tasks, use “all”. If you want to list only the completed tasks, use “task completed”
Add a new task
$ task add <description>
This is a simple example to add a task. You could specify other attributes for the task while adding it or even later on by modifying an existing task. These attributes will slowly become clear in subsequent examples. You need not quote the description unless the description involves some special characters that may be interpreted by the shell.
Mark a task as completed
$ task <task_no> done
Completed tasks will no longer show up in the output of “task long”, but can be seen only with “task all”.
Delete a task
$ task 1,3-5 delete
This example serves to show how you can specify multiple task id’s in the same command. Deleted tasks will never show up in the “task ls” reports.
Mark a task as started
$ task <task_id> start
Mark a task as stopped
$ task <task_id> stop
Modify an existing task
$ task <task_id> modify <modifications>
You can specify a new string to replace the original task description. Or you may add attributes to an existing task. Some of the most important task attributes are listed below.
$ task linux modify +work
This command serves as an example to show that, job_id’s are not the only way to identify tasks. Here the word “linux” is used, so all tasks which contain the word linux in their descriptions will be modified. And the modification in this case is to add the tag “work” to each of these tasks. Tags attached to a task can be seen with the “list long” command. To remove a tag assigned to a task, simply use the same modify command as above except that +work should be replaced by -work.
$ task +work modify pri:H
Here, we select all tasks which have been tagged as “work” and we are assigning a “High”(pri:H) priority to them. Other priority levels available are M(medium priority) and L(low priority). To remove any assigned priorities, simply use the same modify command with an empty priority like so
$ task +work modify pri:
specify due dates
$ task +work pri:H modify due:eom
Here, we select all tasks with a high priority and which have been tagged as “work” and assign a due date to them as eom(end of month). Note the implicit logical AND between pri:H and +work. You could as well have specified the due date as MM/DD/YYYY or Sunday or eoy(stands for end of year).
group tasks into project
$ task '(pri:H or +linux)' modify project:work
This example shows how to use a logical OR instead of the implicit logical AND of the previous example. Here, we select all tasks with either a high priority or tagged as “linux” or both and then, put them all under the same project(or group) called “work”.
add annotations for a task
$ task <task_id> annotate <description>
Annotations are like small notes attached to a task. To remove the annotations, use the command below
$ task <task_id> denotate <pattern>
Here, we remove those annotations which satisfy the “pattern”.
add dependencies for a task
$ task 2 modify depends:6
Here, we are specifying that task 2 depends on task 6. We can list all tasks that are blocked i.e, which depend on other tasks that are not completed.
$ task blocked
We can list all tasks that are unblocked i.e, do not depend on any other pending task with
$ task unblocked
You can remove a dependency by using the same modify command with depends:-6 instead of depends:6
$ task 2 modify depends:-6
wait till a date until task is displayed
Suppose we have a task whose due date is very far out in the future, and we do not want it to be listed in the output of “task list” until a particular date is reached, we can put the task into “waiting” state as follows
$ task 11 modify wait:10/01/2013
Here, we are putting task 11 into a waiting state, which means the task will not show up in the output of “task list” until 1st Oct 2013.
You can see all tasks that are waiting
$ task waiting
Relational operators in filters
We can use relational operators like = != < > <= >= while specifying task filters. As an example, consider
$ task '(pri!=H and due>eom)' long
This command lists all tasks that do not have a high priority and have a due date after the end of the current month.
Syncing tasks between multiple computers running task warrior
If you have a work and a home computer both running task warrior, you can sync tasks between them and the way I do it is via Dropbox(to store the task data). You could also use ssh to sync task data between local and remote computers.
$ task push ~/Dropbox/
This command pushes the local task data into Dropbox. Now, on the other computer, you can get these tasks by doing
$ task pull ~/Dropbox/
pull command however destroys all tasks that are local. If you want to retain your local tasks as well as get new tasks from the other computer, you should use
$ task merge ~/Dropbox/
This way, you get to keep your local tasks as well as get any updated tasks from the other computer. You also have the option of pushing the merged task data to Dropbox as part of the same command.
I have only described commands for common use cases, which is more than enough to keep you neatly organized. However there are several other features available in task warrior that may be useful in some scenarios. The best way to get concise help on these features, and refresh your memory should you forget some of the above commands is
$ task help