[tracker/tracker-cmd: 4/12] tracker: Merged all external commands into 'tracker'



commit 932c57b0a86c77b17beffd5c44a857c95349981d
Author: Martyn Russell <martyn lanedo com>
Date:   Thu Oct 2 18:47:33 2014 +0100

    tracker: Merged all external commands into 'tracker'

 docs/manpages/Makefile.am                          |    3 +-
 docs/manpages/tracker-daemon.1                     |  266 +++++---
 docs/manpages/tracker-import.1                     |   34 -
 docs/manpages/tracker-index.1                      |   63 ++-
 docs/manpages/tracker-info.1                       |   30 +-
 docs/manpages/tracker-reset.1                      |   45 +-
 docs/manpages/tracker-search.1                     |  129 ++--
 docs/manpages/tracker-sparql.1                     |  142 ++--
 docs/manpages/tracker-stats.1                      |   48 --
 docs/manpages/tracker-status.1                     |   64 ++
 docs/manpages/tracker-tag.1                        |   52 +-
 src/tracker/.gitignore                             |    9 -
 src/tracker/Makefile.am                            |   40 +-
 src/tracker/tracker-config.c                       |    1 +
 src/tracker/tracker-config.h                       |    1 +
 src/tracker/tracker-control-general.c              |  161 -----
 src/tracker/tracker-control-miners.c               |  128 ----
 src/tracker/tracker-control.c                      |  191 ------
 src/tracker/tracker-control.h                      |   48 --
 src/tracker/tracker-daemon.c                       |  426 +-----------
 src/tracker/tracker-daemon.h                       |    9 +-
 src/tracker/tracker-import.c                       |  143 ----
 src/tracker/tracker-index.c                        |  376 +++++++++--
 src/tracker/tracker-index.h                        |    9 +-
 src/tracker/tracker-info.c                         |  203 ++----
 src/tracker/tracker-info.h                         |   25 +
 src/tracker/tracker-main.c                         |  206 +-----
 src/tracker/tracker-process.c                      |    1 +
 src/tracker/tracker-process.h                      |    3 +-
 src/tracker/tracker-reset.c                        |   83 ++-
 src/tracker/tracker-reset.h                        |    9 +-
 src/tracker/tracker-search.c                       |  250 +++----
 src/tracker/tracker-search.h                       |   25 +
 src/tracker/tracker-sparql.c                       |  213 ++++---
 src/tracker/tracker-sparql.h                       |   36 +
 src/tracker/tracker-stats.c                        |  285 --------
 src/tracker/tracker-status.c                       |  716 ++++++++++++++++++++
 src/tracker/tracker-status.h                       |   25 +
 src/tracker/tracker-tag.c                          |  164 +++---
 src/tracker/tracker-tag.h                          |   25 +
 tests/functional-tests/common/utils/helpers.py     |    4 +-
 tests/functional-tests/common/utils/system.py      |    4 +-
 tests/functional-tests/create-tests-xml.py         |    2 +-
 tests/functional-tests/fts-tc.py                   |   82 ++--
 tests/functional-tests/ipc/test-busy-handling.vala |    2 +-
 tests/functional-tests/mass-storage-mode.py        |   74 +-
 tests/functional-tests/performance-tc-modified.py  |    8 +-
 tests/functional-tests/performance-tc.py           |    8 +-
 utils/clean-prefix/clean-tracker-prefix            |    4 +-
 utils/data-generators/cc/ttl/README                |    2 +-
 utils/sandbox/tracker-sandbox.py                   |    4 +-
 51 files changed, 2274 insertions(+), 2607 deletions(-)
---
diff --git a/docs/manpages/Makefile.am b/docs/manpages/Makefile.am
index 549546b..e8006a6 100644
--- a/docs/manpages/Makefile.am
+++ b/docs/manpages/Makefile.am
@@ -4,13 +4,12 @@ tmrss = tracker-miner-rss.1
 
 common = \
        tracker-extract.1 \
-       tracker-import.1 \
        tracker-info.1 \
        tracker-miner-fs.1 \
        tracker-daemon.1 \
        tracker-search.1 \
        tracker-sparql.1 \
-       tracker-stats.1 \
+       tracker-status.1 \
        tracker-store.1 \
        tracker-tag.1 \
        tracker-reset.1 \
diff --git a/docs/manpages/tracker-daemon.1 b/docs/manpages/tracker-daemon.1
index 300f4e4..794fbc1 100644
--- a/docs/manpages/tracker-daemon.1
+++ b/docs/manpages/tracker-daemon.1
@@ -4,27 +4,38 @@
 tracker-daemon \- Start, stop, restart and list daemons responsible for indexing content
 
 .SH SYNOPSIS
-\fBtracker daemon\fR [\fIOPTION\fR...]
+.nf
+\fBtracker daemon\fR [\fIoptions\fR...]
+\fBtracker daemon\fR \-s | \-t [\fIdaemons\fR] | \-k [\fIdaemons\fR] | \-l
+\fBtracker daemon\fR \-f | \-w [\fIontology\fR]
+\fBtracker daemon\fR \-\-miner <\fIminer\fR> \-\-pause[-for-process] <\fIreason\fR>
+\fBtracker daemon\fR \-\-miner <\fIminer\fR> \-\-resume <\fIcookie\fR> 
+
+.fi
 
 .SH DESCRIPTION
-.B Manages and checks status of all Tracker processes and data.
+Tracker has many components to it including a "store" for handling data
+set updates and "miners" for handling data mining in their respective
+areas.
+
+The \fBtracker daemon\fR command allows for control of these components.
+This ranges from starting, stopping and killing processes to pausing
+and resuming them. 
 
-Controls Tracker both at process level, and at entity level (store, miners).
+In addition to all this, there are ways to change the log verbsity for
+all processes that generate logs and to follow or watch what is
+happening in real time from a top level and right down where the
+SPARQL commits are happening too.
 
-To start or stop miners, you can use
-.B \-\-start.
-The store is started automatically by the D-Bus calls from the miners.
+If no arguments are provided this command will show the current status
+of all Tracker entities (store and all available data miners).
 
-It also allows checking the status of the Tracker store and all data miners.
-For
-.B tracker-store
-, the status is always
-.B Idle
-unless it is restoring a backup and/or replaying a journal (regardless of
-load from applications or miners). For a list of common statuses, see
-.B \-\-list\-common\-statuses.
+For \fBtracker-store\fR, the status is always "Idle" unless it is
+restoring a backup and/or replaying a journal (see also \fBtracker reset
+--soft\fR). For a list of common statuses, see
+\fB\-\-list\-common\-statuses\fR.
 
-The miners can be paused or resumed using this command and you can
+The data miners can be paused or resumed using this command and you can
 also list miners running and available.
 
 .SH OPTIONS
@@ -32,76 +43,131 @@ also list miners running and available.
 .B \-p, \-\-list\-processes
 This lists all Tracker processes in the system.
 .TP
-.B \-k, \-\-kill=[all|store|miners]
+.B \-k, \-\-kill\fR=[\fIdaemons\fR]
 This uses SIGKILL to stop all Tracker processes found matching the
-parameter, if no extra parameter is passed,
-.B all
-will be assumed. This is not advised unless you are having problems
-stopping Tracker in the first place. This
-.B GUARANTEES
-death.
-.TP
-.B \-t, \-\-terminate=[all|store|miners]
+parameter, if no extra parameter is passed, "all" will be assumed.
+This is not advised unless you are having problems stopping Tracker in
+the first place. This \fBGUARANTEES\fR death.
+
+The possible \fIdaemons\fR options are:
+.sp
+.RS 12
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIall\fR
+\- All daemons.
+.sp
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 2.3
+.\}
+\fIstore\fR
+\- Only the \fBtracker-store\fR.
+.sp
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIminers\fR
+\- Only data miners.
+.sp
+.RE
+
+.TP
+.B \-t, \-\-terminate\fR=[daemons]
 This uses SIGTERM to stop all Tracker processes found matching the
-parameter, if no extra parameter is passed,
-.B all
-will be assumed. This is recommended over \-\-kill because it gives
-the processes time to shutdown cleanly.
+parameter, if no extra parameter is passed, "all" will be assumed.
+This is recommended over \-\-kill because it gives the processes time
+to shutdown cleanly.
+
+For a list of possible \fIdaemons\fR, see \-\-kill.
 .TP
 .B \-s, \-\-start
-Starts all miners. This indirectly starts tracker-store too because it
-is needed for miners to operate properly.
-.TP
-.B \-b, \-\-backup=FILE
-Begins backing up the Tracker databases to the
-.B FILE
-given.
-.TP
-.B \-o, \-\-restore=FILE
-Begins restoring a previous backup (see
-.B \-\-backup
-) to the Tracker databases. The
-.B FILE
-points to the location of the backup.
-.TP
-.B \-\-get-log-verbosity
+Starts all miners. This indirectly starts \fBtracker-store\fR too
+because it is needed for miners to operate properly. The store is
+started from D-Bus.
+.TP
+.B \-\-get\-log\-verbosity
 This displays the log verbosity for ALL components using GSettings for
 this configuration. For possible values, see
-.B \-\-set-log-verbosity.
-.TP
-.B \-\-set-log-verbosity=[debug|detailed|minimal|errors]
-This sets the log verbosity for ALL components using GSettings using
-this configuration option ('verbosity').
-.TP
-.B \-\-collect-debug-info
-Useful when debugging problems to diagnose the state of Tracker on
-your system. The data is output to stdout. Useful if bugs are filed
-against the project itself.
-
-Data collected includes Tracker version in use, disk space available,
-size of the databases on the disk, the configuration in use, states of
-the index (e.g. last filesystem crawl, data set locale, etc.) and
-finally statistics about the data in the database (e.g. how many
-nfo:FileDataObject resources exist).
-.TP
-.B \-S, \-\-status
-Show the current status of all Tracker entities (store and all available
-miners).
-.TP
-.B \-F, \-\-follow
-Follow status changes as they happen. This requires Ctrl+C to stop and
-return to the command line. Each new status is put on a new line.
-.TP
-.B \-w, \-\-watch=[ONTOLOGY]
+.B \-\-set\-log\-verbosity.
+.TP
+.B \-\-set\-log\-verbosity\fR=<\fIverbosity\fR>
+This sets the log verbosity for ALL daemons using GSettings to store
+their "verbosity" configuration.
+
+The possible \fIverbosity\fR options are:
+.sp
+.RS 12
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIdebug\fR
+\- Show EVERYTHING, from debug messages to errors. This often includes
+actual SQL being executed.
+.sp
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 2.3
+.\}
+\fIdetailed\fR
+\- Show enough detail to understand what is happening.
+.sp
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIminimal\fR
+\- Show an overview of what is going on, e.g. stats and when things
+start or stop.
+.sp
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIerrors\fR
+\- Show only warnings, criticals, errors or fatal events.
+.RE
+
+.TP
+.B \-f, \-\-follow
+Follow status changes to daemons as they happen. This is a top level
+view of what is happening. You will see the name for each daemon and a
+state with the progress in that state.
+
+This requires Ctrl+C to stop and return to the command line. Each new
+status is put on a new line.
+
+.TP
+.B \-w, \-\-watch\fR=[\fIontology\fR]
 Watch changes that happen to the database in real time. This requires
 Ctrl+C to stop and return to the command line.
 
-If the
-.B ONTOLOGY
-is unspecified, all changes are shown. The
-.B ONTOLOGY
-can be a comma separated list of shorthand or long hand ontology
-properties. For example:
+If \fIontology\fR is unspecified, all updates are shown. The
+\fIontology\fR can be a comma separated list of shorthand or long hand
+ontology properties. For example:
 
 .nf
     $ tracker-control -w nie:url,nie:mimeType,nfo:fileSize,nie:dataSource
@@ -132,50 +198,42 @@ Additionally, these statuses are not the only ones which may be
 reported by a miner. There may be other states pertaining to the
 specific roles of the miner in question.
 .TP
-.B \-\-list-miners-running
+.B \-\-list\-miners\-running
 This will list all miners which have responded to a D-Bus call.
 Sometimes it is helpful to use this command with
-.B \-\-list-miners-available.
+.B \-\-list\-miners\-available.
 .TP
 .B \-\-list-miners-available
 This will list all miners which are available even if they are not
 running at the moment.
 .TP
-.B \-\-pause-details
+.B \-\-pause\-details
 For listing all miners which are paused and the reasons for being
 paused, you can use this. It will also display the application that
 requested the pause too.
 .TP
-.B \-\-miner=MINER
-This argument is used with
-.B \-\-pause
-or
-.B \-\-resume
-to say which miner you want to pause or resume. You can use the full
-D-Bus name, e.g.
-.B org.freedesktop.Tracker1.Miner.Files
-OR you can use the suffix, e.g.
-.B Files
-.TP
-.B \-\-pause=REASON
-The REASON here is useful to know WHY the miner should be paused. A
+.B \-\-miner\fR=<\fIminer\fR>
+This argument is used with \fB\-\-pause\fR or \fB\-\-resume\fR to say
+which miner you want to pause or resume. You can use the full D-Bus
+name, e.g. "org.freedesktop.Tracker1.Miner.Files" OR you can use
+the suffix, e.g. "Files".
+.TP
+.B \-\-pause\fR=<\fIreason\fR>
+The \fIreason\fR here is useful to know WHY the miner should be paused. A
 miner can be paused many times by multiple applications. Only when all
 pauses have been resumed will it continue. If successful, a cookie
 will be given to uniquely identify the request. This cookie is used to
 resume the pause at a later stage.
 .TP
-.B \-\-pause-for-process=REASON
-This works exactly the same way as
-.B \-\-pause
-with the exception that it only keeps the pause active while the
-calling process is alive. As soon as you press Ctrl+C the pause is
-resumed automatically.
-.TP
-.B \-\-resume=COOKIE
-The COOKIE is given by a successful
-.B \-\-pause
-command. It is a number which identifies each pause request. When all
-pauses have been resumed, the miner will resume working.
+.B \-\-pause\-for\-process\fR=<\fIreason\fR>
+This works exactly the same way as \fB\-\-pause\fR with the exception
+that it only keeps the pause active while the calling process is
+alive. As soon as you press Ctrl+C the pause is resumed automatically.
+.TP
+.B \-\-resume\fR=<\fIcookie\fR>
+The \fIcookie\fR is given by a successful \fB\-\-pause\fR command. It
+is a number which identifies each pause request. When all pauses have
+been resumed, the miner will resume working.
 
 .SH ENVIRONMENT
 .TP
diff --git a/docs/manpages/tracker-index.1 b/docs/manpages/tracker-index.1
index d8f8718..85f5e23 100644
--- a/docs/manpages/tracker-index.1
+++ b/docs/manpages/tracker-index.1
@@ -1,28 +1,63 @@
-.TH tracker-control 1 "September 2009" GNU "User Commands"
+.TH tracker-index 1 "September 2014" GNU "User Commands"
 
 .SH NAME
 tracker-index \- List, pause, resume and command data miners indexing content
 
 .SH SYNOPSIS
-\fBtracker index\fR [\fIOPTION\fR...]
+.nf
+\fBtracker index\fR \-\-reindex\-mime\-type <\fImime1\fR> [[\-m [\fImime2\fR]] ...]
+\fBtracker index\fR \-\-file <\fIfile1\fR> [[\fIfile2\fR] ...]
+\fBtracker index\fR \-\-import <\fIfile1\fR> [[\fIfile2\fR] ...]
+\fBtracker index\fR \-\-backup <\fIfile\fR> | \-\-restore <\fIfile\fR>
+.fi
 
 .SH DESCRIPTION
-Control the indexing process with pausing and resuming and add content
-to be indexed. In addition it is possible to reindex entire MIME
-types, which may be useful in cases where a new extractor or GStreamer
-backend is available and providing support.
+This command perform actions on the current index. The "index" holds a
+snapshot of the working tree in a database.
+
+The index command allows some level of control on existing data
+indexed, such as re-indexing content from a specific demographic -
+e.g. all JPEG images, or simply reindexing an existing or non-existant
+file.
+
+It may be a good idea to backup your index before an upgrade in case
+there is data loss (which should never happen). In those cases, the
+backup command is made available and of course the restore command
+will import an older data set (or index) into an empty index.
+
+Finally, there is an import feature which makes testing or applying a
+"base" data set for use much easier.
+
 .SH OPTIONS
 .TP
-.B \-m, \-\-reindex-mime-type=MIME
-Re-index files which match the \fIMIME\fR type supplied. This is
-usually used when installing new extractors which support \fIMIME\fR
+.B \-m, \-\-reindex-mime\-type\fR=<\fImime1\fR> [[\-m [\fImime2\fR]] ...]
+Re-index files which match the \fImime\fR type supplied. This is
+usually used when installing new extractors which support \fImime\fR
 types previously unsupported. This forces Tracker to re-index those
-files. You can use
-.B \-\-reindex-mime-type
-more than once per \fIMIME\fR type.
+files. You can use \fB\-\-reindex\-mime\-type\fR more than once per
+\fImime\fR type.
+.TP
+.B \-f, \-\-index\fR=<\fIfile1\fR> [[\fIfile2\fR] ...]
+(Re)index a file matching the \fIfile\fR name(s) supplied.
 .TP
-.B \-f, \-\-index-file=FILE
-(Re)index a file matching the \fIFILE\fR type supplied.
+.B \-b, \-\-backup\fR=<\fIfile\fR>
+Begins backing up the Tracker databases and save it to the \fIfile\fR
+given.
+.TP
+.B \-o, \-\-restore\fR=<\fIfile\fR>
+Begins restoring a previous backup from the \fIfile\fR which points to
+the location of the backup generated by \fB\-\-backup\fR.
+.TP
+.B \i, \-\-import\fR=<\fIfile1\fR> [[\fIfile2\fR] ...]
+Allows data to be imported into the index / database by providing
+files with Turtle content.
+
+Multiple \fIfile\fR arguments can be provided to import data from
+multiple files.
+
+The \fIfile\fR argument can be either a local path or a URI. It also
+does not have to be an absolute path.
 
 .SH SEE ALSO
 .BR tracker (1).
+.BR Turtle.
diff --git a/docs/manpages/tracker-info.1 b/docs/manpages/tracker-info.1
index 6dbc97c..f507593 100644
--- a/docs/manpages/tracker-info.1
+++ b/docs/manpages/tracker-info.1
@@ -4,28 +4,22 @@
 tracker-info \- Retrieve all information available for a certain file.
 
 .SH SYNOPSIS
-\fBtracker-info\fR [\fIOPTION\fR...] \fIFILE\fR...
+\fBtracker info\fR [\fIoptions\fR...] <\fIfile1\fR> [[\fIfile2\fR] ...]
 
 .SH DESCRIPTION
-.B tracker-info
-asks for all the known metadata available for the given \fIFILE\fR.
+.B tracker info
+asks for all the known metadata available for the given \fIfile\fR.
 
-Multiple \fIFILE\fR arguments can be provided to retrieve information
+Multiple \fIfile\fR arguments can be provided to retrieve information
 about multiple files.
 
-The \fIFILE\fR argument can be either a local path or a URI. It also
+The \fIfile\fR argument can be either a local path or a URI. It also
 does not have to be an absolute path.
 
 .SH OPTIONS
 .TP
-.B \-?, \-\-help
-Show summary of options.
-.TP
-.B \-V, \-\-version
-Print version.
-.TP
 .B \-f, \-\-full\-namespaces
-By default, all keys and values reported about any given \fIFILE\fR
+By default, all keys and values reported about any given \fIfile\fR
 are returned in shortened form, for example, \fInie:title\fR is shown
 instead of
 \fIhttp://www.semanticdesktop.org/ontologies/2007/01/19/nie#title\fR.
@@ -39,18 +33,18 @@ information about the content of the resource, which could be the
 contents of a file on the disk), then this option displays that in the
 output.
 .TP
-.B \-i, \-\-resource-is-iri
-In most cases, the \fIFILE\fR argument supplied points to a URL or
+.B \-i, \-\-resource\-is\-iri
+In most cases, the \fIfile\fR argument supplied points to a URL or
 PATH which is queried for according to the resource associated with it
-by \fInie:url\fR. However, in cases where the \fIFILE\fR specified
+by \fInie:url\fR. However, in cases where the \fIfile\fR specified
 turns out to be the actual URN itself, this argument is required to
-tell \fBtracker-info\fR not to do the extra step of looking up the URN
+tell "tracker info" not to do the extra step of looking up the URN
 related by \fInie:url\fR.
 
 For example, consider that you store URNs by the actual URL itself and
 use the unique nie:url in another resource (which is quite reasonable
 when using containers and multi-resource conditions), you would need
-this argument to tell \fBtracker-info\fR that the \fIFILE\fR supplied
+this argument to tell "tracker info" that the \fIfile\fR supplied
 is actually a URN not URL.
 .TP
 .B \-t, \-\-turtle
@@ -83,7 +77,7 @@ be if this environment variable was undefined.
 Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
 With this environment variable pointing to a text file you can override these
 settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in tracker-store.
+newly created SQLite connection in \fBtracker-store\fR.
 
 .SH SEE ALSO
 .BR tracker-store (1),
diff --git a/docs/manpages/tracker-reset.1 b/docs/manpages/tracker-reset.1
index c1c5824..89dc621 100644
--- a/docs/manpages/tracker-reset.1
+++ b/docs/manpages/tracker-reset.1
@@ -1,35 +1,44 @@
 .TH tracker-reset 1 "September 2014" GNU "User Commands"
 
 .SH NAME
-tracker-reset \- Reset the index, configuration or replay journal
+tracker-reset \- Reset the index and configuration
 
 .SH SYNOPSIS
-\fBtracker reset\fR [\fIOPTION\fR...]
+\fBtracker reset\fR [\-\-hard | \-\-soft] [\-\-config]
 
 .SH DESCRIPTION
+The reset command will change either your configuration or index
+irreversibly and should be used with care. Other than tags, actual
+data (e.g. files) should not be affected by this command.
+
+The "index" is a link between your content (either locally or
+remotely) and how it can be found quickly using a number of different
+queries. Under the hood, this is done using a database.
+
+Removing all data and starting again from the beginning with an empty
+data set (which is a common use of this command) is done by using the
+hard reset option. This behaves as if Tracker was just installed.
 
 .SH OPTIONS
 .TP
-.B \-r, \-\-hard-reset
-This kills all processes in the same way that
-.B \-\-kill
-does but it also removes all databases. Restarting
-.B tracker-store
-re-creates the databases.
+.B \-r, \-\-hard
+This kills all processes in the same way that \fBtracker daemon
+\-\-kill\fR does but it also removes all databases. Restarting
+\fBtracker-store\fR re-creates the databases.
 .TP
-.B \-e, \-\-soft-reset
-A soft reset works exactly the same way that
-.B \-\-hard-reset
-does, with the exception that the backup and journal are not removed.
-These are restored when
-.B tracker-store
-is restarted.
+.B \-e, \-\-soft
+A soft reset works exactly the same way that \fB\-\-hard\fR does, with
+the exception that the backup and journal are not removed. These are
+restored when \fBtracker-store\fR is restarted. This command is useful if
+you have a corrupt database but want to reply the journal to restore
+it to the last known good place.
 .TP
-.B \-c, \-\-remove-config
-This removes all config files in $HOME/.config/tracker. All files
-listed are files which were found and successfully removed.
+.B \-c, \-\-config
+This removes all config files in \fI$HOME/.config/tracker\fR. All
+files listed are files which were found and successfully removed.
 Restarting the respective processes re-creates the default
 configuration files.
 
 .SH SEE ALSO
+.BR tracker-daemon (1).
 .BR tracker (1).
diff --git a/docs/manpages/tracker-search.1 b/docs/manpages/tracker-search.1
index 3287865..109602e 100644
--- a/docs/manpages/tracker-search.1
+++ b/docs/manpages/tracker-search.1
@@ -1,117 +1,114 @@
 .TH tracker-search 1 "July 2009" GNU "User Commands"
 
 .SH NAME
-tracker-search \- Search all content for keywords
+tracker-search \- Search for content by type or across all types
 
 .SH SYNOPSIS
-\fBtracker search\fR [\fIOPTION\fR...] \fIEXPRESSION\fR [\fIEXPRESSION\fR...]
+\fBtracker search\fR [\fIoptions\fR...] [[\fIexpression1\fR] ...]
 
 .SH DESCRIPTION
 .B tracker search
-searches all indexed content for \fIEXPRESSION\fR. The resource in
-which \fIEXPRESSION\fR matches must exist (see 
+searches all indexed content for \fIexpression\fR. The resource in
+which \fIexpression\fR matches must exist (see 
 .B \-\-all
 for more information). All results are returned in ascending order. In
-all cases, if no \fIEXPRESSION\fR is given for an argument (like 
+all cases, if no \fIexpression\fR is given for an argument (like 
 .B \-\-folders
 for example) then ALL items in that category are returned instead.
 .TP
-\fIEXPRESSION\fR
+\fIexpression\fR
 One or more terms to search. The default operation is a logical AND.
 For logical OR operations, see -r.
 
 .SH OPTIONS
 .TP
-.B \-l, \-\-limit=N
-Limit search to N results. The default is 10 or 512 with \-\-disable\-snippets.
-.TP
-.B \-o, \-\-offset=N
-Offset the search results by N. For example, start at item number 10
-in the results. The default is 0.
-.TP
-.B \-r, \-\-or-operator
-Use OR for search terms instead of AND (the default)
-.TP
-.B \-d, \-\-detailed
-Show the unique URN associated with each search result. This does not
-apply to \-\-music\-albums and \-\-music\-artists.
-.TP
-.B \-a, \-\-all
-Show results which might not be available. This might bebecause a
-removable media is not mounted for example. Without this option,
-resources are only shown if they exist. This option applies to all
-command line switches except
-.TP
-.B \-\-disable-snippets
-Results are shown with snippets. Snippets are context around the word
-that was searched for in the first place. This gives some idea of if
-the resource found is the right one. Snippets require Full Text Search
-to be compile time enabled AND to not be disabled with
-\-\-disable\-fts. Using \-\-disable\-snippets only shows the resources
-which matched, no context is provided about where the match occurred.
-.TP
-.B \-\-disable-fts
-If Full Text Search (FTS) is available, this option allows it to be
-disabled for one off searches. This returns results slightly
-using particular properties to match the search terms (like nie:title)
-instead of looking for the search terms amongst ALL properties. It is
-more limiting to do this, but sometimes searching without FTS can
-yield better results if the FTS ranking is off.
-.TP
-.B \-\-disable-color
-This disables any ANSI color use on the command line. By default this
-is enabled to make it easier to see results.
-.B \-\-music-albums
-and
-.B \-\-music-artists.
-.TP
 .B \-f, \-\-files
-Search for files of any type matching \fIEXPRESSION\fR (optional).
+Search for files of any type matching \fIexpression\fR (optional).
 .TP
 .B \-s, \-\-folders
-Search for folders matching \fIEXPRESSION\fR (optional).
+Search for folders matching \fIexpression\fR (optional).
 .TP
 .B \-m, \-\-music
-Search for music files matching \fIEXPRESSION\fR (optional).
+Search for music files matching \fIexpression\fR (optional).
 .TP
-.B      \-\-music\-albums
-Search for music albums matching \fIEXPRESSION\fR (optional).
+.B \-\-music\-albums
+Search for music albums matching \fIexpression\fR (optional).
 .TP
-.B      \-\-music\-artists
-Search for music artists matching \fIEXPRESSION\fR (optional).
+.B \-\-music\-artists
+Search for music artists matching \fIexpression\fR (optional).
 .TP
 .B \-i, \-\-images
-Search for images matching \fIEXPRESSION\fR (optional).
+Search for images matching \fIexpression\fR (optional).
 .TP
 .B \-v, \-\-videos
-Search for videos matching \fIEXPRESSION\fR (optional).
+Search for videos matching \fIexpression\fR (optional).
 .TP
 .B \-t, \-\-documents
-Search for documents matching \fIEXPRESSION\fR (optional).
+Search for documents matching \fIexpression\fR (optional).
 .TP
 .B \-e, \-\-emails
-Search for emails matching \fIEXPRESSION\fR (optional). Returns a list
+Search for emails matching \fIexpression\fR (optional). Returns a list
 of subjects for emails found.
 .TP
 .B \-c, \-\-contacts
-Search for contacts matching \fIEXPRESSION\fR (optional). Returns a list
+Search for contacts matching \fIexpression\fR (optional). Returns a list
 of names and email addresses found.
 .TP
 .B \-\-software
-Search for software installed matching \fIEXPRESSION\fR (optional). Returns a list
+Search for software installed matching \fIexpression\fR (optional). Returns a list
 of desktop files and application titles found.
 .TP
-.B \-\-software-categories
-Search for software categories matching \fIEXPRESSION\fR (optional). Returns a list
+.B \-\-software\-categories
+Search for software categories matching \fIexpression\fR (optional). Returns a list
 of urns and their categories (e.g. Settings, Video, Utility, etc).
 .TP
 .B \-\-feeds
-Search through RSS feed information matching \fIEXPRESSION\fR (optional). Returns a list
+Search through RSS feed information matching \fIexpression\fR (optional). Returns a list
 of those found.
 .TP
 .B \-b, \-\-bookmarks
-Search through bookmarks matching \fIEXPRESSION\fR (optional). Returns a list
+Search through bookmarks matching \fIexpression\fR (optional). Returns a list
 titles and links for each bookmark found.
+.TP
+.B \-l, \-\-limit\fR=<\fIlimit\fR>
+Limit search to \fIlimit\fR results. The default is 10 or 512 with \-\-disable\-snippets.
+.TP
+.B \-o, \-\-offset\fR=<\fIoffset\fR>
+Offset the search results by \fIoffset\fR. For example, start at item number 10
+in the results. The default is 0.
+.TP
+.B \-r, \-\-or\-operator
+Use OR for search terms instead of AND (the default)
+.TP
+.B \-d, \-\-detailed
+Show the unique URN associated with each search result. This does not
+apply to \-\-music\-albums and \-\-music\-artists.
+.TP
+.B \-a, \-\-all
+Show results which might not be available. This might bebecause a
+removable media is not mounted for example. Without this option,
+resources are only shown if they exist. This option applies to all
+command line switches except
+.TP
+.B \-\-disable\-snippets
+Results are shown with snippets. Snippets are context around the word
+that was searched for in the first place. This gives some idea of if
+the resource found is the right one. Snippets require Full Text Search
+to be compile time enabled AND to not be disabled with
+\-\-disable\-fts. Using \-\-disable\-snippets only shows the resources
+which matched, no context is provided about where the match occurred.
+.TP
+.B \-\-disable\-fts
+If Full Text Search (FTS) is available, this option allows it to be
+disabled for one off searches. This returns results slightly
+using particular properties to match the search terms (like "nie:title")
+instead of looking for the search terms amongst ALL properties. It is
+more limiting to do this, but sometimes searching without FTS can
+yield better results if the FTS ranking is off.
+.TP
+.B \-\-disable\-color
+This disables any ANSI color use on the command line. By default this
+is enabled to make it easier to see results.
 
 .SH ENVIRONMENT
 .TP
diff --git a/docs/manpages/tracker-sparql.1 b/docs/manpages/tracker-sparql.1
index 9435928..2e5df8c 100644
--- a/docs/manpages/tracker-sparql.1
+++ b/docs/manpages/tracker-sparql.1
@@ -4,41 +4,50 @@
 tracker-sparql \- Use SparQL to query the Tracker databases.
 
 .SH SYNOPSIS
-\fBtracker sparql\fR [\fIOPTION\fR...] [-q \fIQUERY\fR] | [-f \fIFILE\fR]
+.nf
+\fBtracker sparql\fR \-q <\fIsparql\fR> [\-u] | \-f <\fIfile\fR>
+\fBtracker sparql\fR \-t [\fIclass\fR] [-s <\fIneedle\fR>] [\-p]
+\fBtracker sparql\fR [\-c] [\-p] [\-x] [-n [\fIclass\fR]] [\-i [\fIproperty\fR]] [\-s <\fIneedle\fR>]
+\fBtracker sparql\fR [\-\-get\-longhand <\fIclass\fR>] [\-\-get\-shorthand <\fIclass\fR>]
+.fi
 
 .SH DESCRIPTION
-.B tracker sparql
-allows the caller to run an RDF query on the database. This can be
-done two ways. Either by providing a \fIFILE\fR with the query or by
-providing a string with the \fIQUERY\fR string.
-
-The \fIFILE\fR argument can be either a local path or a URI. It also
+This command allows probing of the current database schema (also
+known as ontology) and running low level queries or updates on the
+data set. In terms of the database ontology, it's easy to find out what
+properties are indexed for speed, or notified on changes, what classes are
+available and the properties belonging to those classes. There are
+also visual tools to display an ascii tree layout of the classes and
+their relationships to each other.
+
+When the caller runs a query, the query is in RDF and SPARQL. This can be
+done two ways. Either by providing a \fIfile\fR with the query or by
+providing a string with the \fIsparql\fR query.
+
+The \fIfile\fR argument can be either a local path or a URI. It also
 does not have to be an absolute path.
 
 .SH OPTIONS
 .TP
-.B \-f, \-\-file=FILE
-Use a \fIFILE\fR with SPARQL content to query or update.
+.B \-f, \-\-file\fR=<\fIfile\fR>
+Use a \fIfile\fR with SPARQL content to query or update.
 .TP
-.B \-q, \-\-query=SPARQL
-Use a \fISPARQL\fR string to query the database with.
+.B \-q, \-\-query\fR=<\fIsparql\fR>
+Use a \fIsparql\fR string to query the database with.
 .TP
 .B \-u, \-\-update
-This has to be used with
-.B \-\-query.
-This tells
-.B tracker-sparql
-to use the SPARQL update extensions so it knows it isn't a regular
-data lookup request. So if your query is intended to change data in
-the database, this option is needed.
+This has to be used with \fB\-\-query\fR. This tells
+"tracker sparql" to use the SPARQL update extensions so it knows
+it isn't a regular data lookup request. So if your query is intended
+to change data in the database, this option is needed.
 .TP
-.B \-c, \-\-list-classes
+.B \-c, \-\-list\-classes
 Returns a list of classes which describe the ontology used for storing
 data. These classes are also used in queries. For example,
 \fIhttp://www.w3.org/2000/01/rdf-schema#Resource\fR is one of many
 classes which should be returned here.
 .TP
-.B \-x, \-\-list-class-prefixes
+.B \-x, \-\-list\-class\-prefixes
 Returns a list of classes and their related prefixes. Prefixes are
 used to make querying a lot simpler and are much like an alias. For
 example, \fIhttp://www.w3.org/2000/01/rdf-schema#Resource\fR has the
@@ -47,16 +56,16 @@ prefix \fIrdfs\fR so queries can be cut down to:
 "SELECT ?u WHERE { ?u a rdfs:Resource }"
 
 .TP
-.B \-p, \-\-list-properties=CLASS
-Returns a list of properties which pertain to a class. You can use
-both formats here for the class, either the full name
+.B\-p, \-\-list\-properties\fR=[\fIclass\fR]
+Returns a list of properties which pertain to a \fIclass\fR. You can
+use both formats here for the \fIclass\fR, either the full name
 \fIhttp://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Video\fR
 or the shortened prefix name \fInfo:Video\fR.
 
 This gives the following result:
 
 .nf
-$ tracker-sparql -p nfo:Video
+$ tracker sparql -p nfo:Video
 
 Properties: 2
   http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#frameRate
@@ -64,39 +73,34 @@ Properties: 2
 .fi
 
 These properties \fInfo:frameRate\fR and \fInfo:frameCount\fR can then
-be used in queries (see also
-.B \-\-query
-).
+be used in queries.
 
-See also
-.B \-\-tree
+See also \fB\-\-tree\fR and \fB\-\-query\fR.
 
 .TP
-.B \-n, \-\-list-notifies=CLASS
+.B \-n, \-\-list\-notifies\fR=[\fIclass\fR]
 Returns a list of classes which are notified over D-Bus about any
-changes that occur in the database. \fICLASS\fR does not have to be
+changes that occur in the database. The \fIclass\fR does not have to be
 supplied here. This is optional and filters the results according to
-any argument supplied. With no \fICLASS\fR, all classes are listed.
+any argument supplied. With no \fIclass\fR, all classes are listed.
 
 .TP
-.B \-i, \-\-list-indexes=PROPERTY
+.B \-i, \-\-list\-indexes\fR=[\fIproperty\fR]
 Returns a list of properties which are indexed in the database.
-Indexes improves query speed but also add an indexing penalty.
-\fIPROPERTY\fR does not have to be supplied here. This is optional and
+Indexes improves query speed but also add an indexing penalty. The
+\fIproperty\fR does not have to be supplied here. This is optional and
 filters the results according to any argument supplied. With no
-\fIPROPERTY\fR, all properties are listed.
+\fIproperty\fR, all properties are listed.
 
 .TP
-.B \-t, \-\-tree [<CLASS>]
-Prints a tree showing all parent classes of \fICLASS\fR in the
-ontology. \fICLASS\fR can be provided in shorthand or longhand (see
-.B \-\-get\-shorthand
-and
-.B \-\-get\-longhand
-for details). For example:
+.B \-t, \-\-tree\fR=[\fIclass\fR]
+Prints a tree showing all parent classes of \fIclass\fR in the
+ontology. The \fIclass\fR can be provided in shorthand or longhand (see
+\fB\-\-get\-shorthand\fR and \fB\-\-get\-longhand\fR for details). For
+example:
 
 .nf
-$ tracker-sparql -t nmo:MMSMessage
+$ tracker sparql -t nmo:MMSMessage
 ROOT
   +-- rdfs:Resource (C)
   |  +-- nie:InformationElement (C)
@@ -107,20 +111,18 @@ ROOT
   |  |  |  |  |  |  `-- nmo:MMSMessage (C)
 .fi
 
-If no \fICLASS\fR is given, the entire tree is shown.
+If no \fIclass\fR is given, the entire tree is shown.
 
 The
 .B \-\-search
 command line option can be used to highlight parts of the tree you're
 looking for. The search is case insensitive.
 
-The
-.B \-\-properties
-command line option can be used to show properties for each class
-displayed, for example:
+The \fB\-\-properties\fR command line option can be used to show
+properties for each class displayed, for example:
 
 .nf
-$ tracker-sparql -t nfo:FileDataObject -p
+$ tracker sparql -t nfo:FileDataObject -p
 ROOT
   +-- rdfs:Resource (C)
   |  --> http://purl.org/dc/elements/1.1/contributor (P)
@@ -172,13 +174,13 @@ ROOT
 .fi
 
 .TP
-.B \-s, \-\-search=TERM
+.B \-s, \-\-search\fR=<\fIneedle\fR>
 Returns a list of classes and properties which partially match
-\fITERM\fR in the ontology. This is a case insensitive match, for
+\fIneedle\fR in the ontology. This is a case insensitive match, for
 example:
 
 .nf
-$ tracker-sparql -s text
+$ tracker sparql -s text
 
 Classes: 4
   http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument
@@ -193,27 +195,25 @@ Properties: 4
   http://www.tracker-project.org/temp/scal#textLocation
 .fi
 
-See also
-.B \-\-tree
-
+See also \fB\-\-tree\fR.
 
 .TP
-.B \-\-get\-shorthand <CLASS>
+.B \-\-get\-shorthand\fR=<\fIclass\fR>
 Returns the shorthand for a class given by a URL.
 For example:
 
 .nf
-$ tracker-sparql --get-shorthand 
http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#plainTextMessageContent
+$ tracker sparql --get-shorthand 
http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#plainTextMessageContent
 nmo:plainTextMessageContent
 .fi
 
 .TP
-.B \-\-get\-longhand <CLASS>
+.B \-\-get\-longhand\fR=<\fIclass\fR>
 Returns the longhand for a class given in the form of CLASS:PROPERTY.
 For example:
 
 .nf
-$ tracker-sparql --get-longhand nmm:MusicPiece
+$ tracker sparql --get-longhand nmm:MusicPiece
 http://www.tracker-project.org/temp/nmm#MusicPiece
 .fi
 
@@ -241,7 +241,7 @@ be if this environment variable was undefined.
 Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
 With this environment variable pointing to a text file you can override these
 settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in tracker-store.
+newly created SQLite connection in \fBtracker-store\fR.
 
 .SH EXAMPLES
 .TP
@@ -249,7 +249,7 @@ List all classes
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?cl WHERE { ?cl a rdfs:Class }"
+$ tracker sparql -q "SELECT ?cl WHERE { ?cl a rdfs:Class }"
 .fi
 
 .TP
@@ -257,7 +257,7 @@ List all properties for the Resources class (see \-\-list-properties)
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?prop WHERE {
+$ tracker sparql -q "SELECT ?prop WHERE {
       ?prop a rdf:Property ;
       rdfs:domain <http://www.w3.org/2000/01/rdf-schema#Resource>
  }"
@@ -268,7 +268,7 @@ List all class namespace prefixes
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?prefix ?ns WHERE {
+$ tracker sparql -q "SELECT ?prefix ?ns WHERE {
       ?ns a tracker:Namespace ;
       tracker:prefix ?prefix
   }"
@@ -279,7 +279,7 @@ List all music files
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?song WHERE { ?song a nmm:MusicPiece }"
+$ tracker sparql -q "SELECT ?song WHERE { ?song a nmm:MusicPiece }"
 .fi
 
 .TP
@@ -287,7 +287,7 @@ List all music albums
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?album ?title COUNT(?song)
+$ tracker sparql -q "SELECT ?album ?title COUNT(?song)
                      AS songs
                      SUM(?length) AS totallength
                      WHERE {
@@ -303,7 +303,7 @@ List all music from a particular artist
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?song ?title WHERE {
+$ tracker sparql -q "SELECT ?song ?title WHERE {
       ?song nmm:performer [ nmm:artistName 'Artist Name' ] ;
       nie:title ?title
   }"
@@ -314,7 +314,7 @@ Set the played count for a song
 
 .BR
 .nf
-$ tracker-sparql -u -q "DELETE {
+$ tracker sparql -u -q "DELETE {
       <file:///home/user/Music/song.mp3> nie:usageCounter ?count
   } WHERE {
       <file:///home/user/Music/song.mp3> nie:usageCounter ?count
@@ -328,7 +328,7 @@ List all image files
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?image WHERE { ?image a nfo:Image }"
+$ tracker sparql -q "SELECT ?image WHERE { ?image a nfo:Image }"
 .fi
 
 .TP
@@ -336,7 +336,7 @@ List all image files with a specific tag
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?image WHERE {
+$ tracker sparql -q "SELECT ?image WHERE {
       ?image a nfo:Image ;
       nao:hasTag [ nao:prefLabel 'tag' ]
   }"
@@ -347,7 +347,7 @@ List all image files created on a specific month and order by date
 
 .BR
 .nf
-$ tracker-sparql -q "SELECT ?image ?date WHERE {
+$ tracker sparql -q "SELECT ?image ?date WHERE {
       ?image a nfo:Image ;
       nie:contentCreated ?date .
       FILTER (?date >= '2008-07-01T00:00:00' &&
diff --git a/docs/manpages/tracker-status.1 b/docs/manpages/tracker-status.1
new file mode 100644
index 0000000..6afb9a3
--- /dev/null
+++ b/docs/manpages/tracker-status.1
@@ -0,0 +1,64 @@
+.TH tracker-status 1 "September 2014" GNU "User Commands"
+
+.SH NAME
+tracker-status \- Provide status and statistics on the data indexed
+
+.SH SYNOPSIS
+.nf
+\fBtracker status\fR
+\fBtracker status\fR \-\-stat [-a] [[\fIexpression1\fR]...]
+\fBtracker status\fR \-\-collect\-debug\-info
+.fi
+
+.SH DESCRIPTION
+Display the status of the current index and data set.
+
+With the \fB\-\-stat\fR option, displays statistics about the RDF
+classes and how many of each exist for data set that has been indexed.
+For example, "10 Folders".
+
+This command also provides a way to collect information for debug
+purposes using the \fB\-\-collect\-debug\-info\fR option.
+
+.SH OPTIONS
+.TP
+.B \-\-stat\fR[=\fIexpression\fR]
+By default, only common and useful classes are shown, e.g.
+"nfo:Document" or "nfo:Folder", for a full set of statistics, see the
+\fB\-\-all\fR option.
+
+If one or more \fIexpression\fR arguments is given, the statistics
+returned are filtered to only show information those RDF types
+matching \fIexpression\fR (case folded and matching accented
+variants). The RDF classes are detailed by the Nepomuk otology
+specification. A list of possible classes matching \fIexpression\fR,
+see \fBtracker sparql \-c\fR.
+.TP
+.B \-a, \-\-all
+Display statistics about ALL RDF classes that exist in the database.
+Without this option only the common RDF classes will be shown, for
+example "nfo:Document" and "nfo:FileDataObject".
+
+This option is implied if search terms are provided to filter ALL
+possible statistics.
+.TP
+.B \-\-collect\-debug\-info
+Useful when debugging problems to diagnose the state of Tracker on
+your system. The data is output to stdout. Useful if bugs are filed
+against the project itself.
+
+Data collected includes Tracker version in use, disk space available,
+size of the databases on the disk, the configuration in use, states of
+the index (e.g. last filesystem crawl, data set locale, etc.) and
+finally statistics about the data in the database (e.g. how many
+"nfo:FileDataObject" resources exist).
+
+.SH SEE ALSO
+.BR tracker-store (1),
+.BR tracker-control (1),
+.BR tracker-sparql (1),
+.BR tracker-info (1).
+.TP
+.BR http://nepomuk.semanticdesktop.org/
+.TP
+.BR http://www.w3.org/TR/rdf-sparql-query/
diff --git a/docs/manpages/tracker-tag.1 b/docs/manpages/tracker-tag.1
index 9e85f16..b450f8f 100644
--- a/docs/manpages/tracker-tag.1
+++ b/docs/manpages/tracker-tag.1
@@ -4,41 +4,23 @@
 tracker-tag \- Add, remove and list tags.
 
 .SH SYNOPSIS
-\fBtracker tag\fR [\fIOPTION...\fR] FILE [\fIFILE...\fR]
 .nf
-\fBtracker tag\fR [\fIOPTION...\fR] -t [[\fITAG\fR] [\fITAG\fR] ...\fR]
+\fBtracker tag\fR \fIFILE1\fR [\fIFILE2\fR ...] [\-l <limit>] [\-o <offset>] [\-r]
+\fBtracker tag\fR \-t [[\fITAG1\fR] [\fITAG2\fR] ...] [\-s] [\-r]
+\fBtracker tag\fR \-a <\fITAG\fR> [-e <description>] 
+\fBtracker tag\fR \-d <\fITAG\fR>
 .fi
 
 .SH DESCRIPTION
-.B tracker tag
-allows the caller add tags, remove tags and list tags by URN or to
-list all tags and the files associated with them.
+List tags for local files or by the tag labels themselves if \-t is used.
+
+It's also possible to manage tags with the \-a and and \-d options.
 
 The \fIFILE\fR argument can be either a local path or a URI. It also
 does not have to be an absolute path.
 
 .SH OPTIONS
 .TP
-.B \-l, \-\-limit=N
-Limit search to N results. The default is 512.
-.TP
-.B \-o, \-\-offset=N
-Offset the search results by N. For example, start at item number 10
-in the results. The default is 0.
-.TP
-.B \-r, \-\-and-operator
-Use AND operator for search terms instead of OR(the default). For
-example:
-
-.nf
-$ tracker-tag -s -t sliff sloff
-.fi
-
-Should show files in the database that have both the \fIsliff\fR
-.B AND
-\fIsloff\fR tags.
-
-.TP
 .B \-t, \-\-list
 List all tags. Results include the number of files associated with
 that tag and the tag's unique identifier. You can show the files
@@ -77,6 +59,24 @@ This option ONLY applies when using
 .B \-\-add
 and provides a description to go with the tag label according to
 \fISTRING\fR.
+.TP
+.B \-l, \-\-limit=N
+Limit search to N results. The default is 512.
+.TP
+.B \-o, \-\-offset=N
+Offset the search results by N. For example, start at item number 10
+in the results. The default is 0.
+.TP
+.B \-r, \-\-and-operator
+Use AND operator for search terms instead of OR (the default). For
+example:
+
+.nf
+$ tracker-tag -s -t sliff sloff
+.fi
+
+Should show files in the database that have both the \fIsliff\fR and
+\fIsloff\fR tags.
 
 .SH ENVIRONMENT
 .TP
@@ -102,7 +102,7 @@ be if this environment variable was undefined.
 Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
 With this environment variable pointing to a text file you can override these
 settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in tracker-store.
+newly created SQLite connection in \fBtracker-store\fR.
 
 .SH SEE ALSO
 .BR tracker-store (1),
diff --git a/src/tracker/.gitignore b/src/tracker/.gitignore
index 5f94367..900eea1 100644
--- a/src/tracker/.gitignore
+++ b/src/tracker/.gitignore
@@ -1,10 +1 @@
-tracker-import
-tracker-info
-tracker-processes
-tracker-search
-tracker-sparql
-tracker-stats
-tracker-status
-tracker-tag
-tracker-control
 tracker
diff --git a/src/tracker/Makefile.am b/src/tracker/Makefile.am
index 0af7c90..99e1c34 100644
--- a/src/tracker/Makefile.am
+++ b/src/tracker/Makefile.am
@@ -14,37 +14,13 @@ libs =                                                 \
        $(BUILD_LIBS)                                  \
        $(TRACKER_LIBS)
 
-bin_PROGRAMS =                                         \
-       tracker \
-       tracker-import                                 \
-       tracker-info                                   \
-       tracker-search                                 \
-       tracker-sparql                                 \
-       tracker-stats                                  \
-       tracker-tag
-
-tracker_search_SOURCES = tracker-search.c
-tracker_search_LDADD = $(libs)
-
-tracker_stats_SOURCES = tracker-stats.c
-tracker_stats_LDADD = $(libs)
-
-tracker_tag_SOURCES = tracker-tag.c
-tracker_tag_LDADD = $(libs)
-
-tracker_info_SOURCES = tracker-info.c
-tracker_info_LDADD = $(libs)
-
-tracker_sparql_SOURCES = tracker-sparql.c
-tracker_sparql_LDADD = $(libs)
-
-tracker_import_SOURCES = tracker-import.c
-tracker_import_LDADD = $(libs)
+bin_PROGRAMS = tracker
 
 tracker_SOURCES = \
        tracker-main.c \
        tracker-config.c \
        tracker-config.h \
+       tracker-color.h \
        tracker-daemon.c \
        tracker-daemon.h \
        tracker-dbus.c \
@@ -53,10 +29,20 @@ tracker_SOURCES = \
        tracker-help.h \
        tracker-index.c \
        tracker-index.h \
+       tracker-info.c \
+       tracker-info.h \
        tracker-process.c \
        tracker-process.h \
        tracker-reset.c \
-       tracker-reset.h
+       tracker-reset.h \
+       tracker-search.c \
+       tracker-search.h \
+       tracker-sparql.c \
+       tracker-sparql.h \
+       tracker-status.c \
+       tracker-status.h \
+       tracker-tag.c \
+       tracker-tag.h
 
 tracker_LDADD = \
        $(top_builddir)/src/libtracker-control/libtracker-control- TRACKER_API_VERSION@.la \
diff --git a/src/tracker/tracker-config.c b/src/tracker/tracker-config.c
index d604634..737b7c0 100644
--- a/src/tracker/tracker-config.c
+++ b/src/tracker/tracker-config.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
diff --git a/src/tracker/tracker-config.h b/src/tracker/tracker-config.h
index 0a11eb0..748e6b9 100644
--- a/src/tracker/tracker-config.h
+++ b/src/tracker/tracker-config.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
diff --git a/src/tracker/tracker-daemon.c b/src/tracker/tracker-daemon.c
index ddfe5cb..f37f1a1 100644
--- a/src/tracker/tracker-daemon.c
+++ b/src/tracker/tracker-daemon.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -89,8 +90,6 @@ static gboolean get_log_verbosity;
 static gboolean start;
 static gchar *backup;
 static gchar *restore;
-static gboolean collect_debug_info;
-
 
 #define DAEMON_OPTIONS_ENABLED() \
        ((status || follow || watch || list_common_statuses) || \
@@ -108,8 +107,7 @@ static gboolean collect_debug_info;
          set_log_verbosity || \
          start || \
          backup || \
-         restore || \
-         collect_debug_info))
+         restore));
 
 static gboolean term_option_arg_func (const gchar  *option_value,
                                       const gchar  *value,
@@ -131,10 +129,6 @@ static const gchar *statuses[8] = {
 
 static GOptionEntry entries[] = {
        /* Status */
-       { "status", 'S', 0, G_OPTION_ARG_NONE, &status,
-         N_("Show current status"),
-         NULL
-       },
        { "follow", 'f', 0, G_OPTION_ARG_NONE, &follow,
          N_("Follow status changes as they happen"),
          NULL
@@ -188,21 +182,12 @@ static GOptionEntry entries[] = {
        { "start", 's', 0, G_OPTION_ARG_NONE, &start,
          N_("Starts miners (which indirectly starts tracker-store too)"),
          NULL },
-       { "backup", 'b', 0, G_OPTION_ARG_FILENAME, &backup,
-         N_("Backup databases to the file provided"),
-         N_("FILE") },
-       { "restore", 'o', 0, G_OPTION_ARG_FILENAME, &restore,
-         N_("Restore databases from the file provided"),
-         N_("FILE") },
        { "set-log-verbosity", 0, 0, G_OPTION_ARG_STRING, &set_log_verbosity,
          N_("Sets the logging verbosity to LEVEL ('debug', 'detailed', 'minimal', 'errors') for all 
processes"),
          N_("LEVEL") },
        { "get-log-verbosity", 0, 0, G_OPTION_ARG_NONE, &get_log_verbosity,
          N_("Show logging values in terms of log verbosity for each process"),
          NULL },
-       { "collect-debug-info", 0, 0, G_OPTION_ARG_NONE, &collect_debug_info,
-         N_("Collect debug information useful for problem reporting and investigation, results are output to 
terminal"),
-         NULL },
        { NULL }
 };
 
@@ -1238,253 +1223,8 @@ term_option_arg_func (const gchar  *option_value,
        return TRUE;
 }
 
-static gboolean
-has_valid_uri_scheme (const gchar *uri)
-{
-       const gchar *s;
-
-       s = uri;
-
-       if (!g_ascii_isalpha (*s)) {
-               return FALSE;
-       }
-
-       do {
-               s++;
-       } while (g_ascii_isalnum (*s) || *s == '+' || *s == '.' || *s == '-');
-
-       return (*s == ':');
-}
-
-static gchar *
-get_uri_from_arg (const gchar *arg)
-{
-       gchar *uri;
-
-       /* support both, URIs and local file paths */
-       if (has_valid_uri_scheme (arg)) {
-               uri = g_strdup (arg);
-       } else {
-               GFile *file;
-
-               file = g_file_new_for_commandline_arg (arg);
-               uri = g_file_get_uri (file);
-               g_object_unref (file);
-       }
-
-       return uri;
-}
-
-static void
-collect_debug (void)
-{
-       /* What to collect?
-        * This is based on information usually requested from maintainers to users.
-        *
-        * 1. Package details, e.g. version.
-        * 2. Disk size, space left, type (SSD/etc)
-        * 3. Size of dataset (tracker-stats), size of databases
-        * 4. Current configuration (libtracker-fts, tracker-miner-fs, tracker-extract)
-        *    All txt files in ~/.cache/
-        * 5. Statistics about data (tracker-stats)
-        */
-
-       GDir *d;
-       gchar *data_dir;
-       gchar *str;
-
-       data_dir = g_build_filename (g_get_user_cache_dir (), "tracker", NULL);
-
-       /* 1. Package details, e.g. version. */
-       g_print ("[Package Details]\n");
-       g_print ("%s: " PACKAGE_VERSION "\n", _("Version"));
-       g_print ("\n\n");
-
-       /* 2. Disk size, space left, type (SSD/etc) */
-       guint64 remaining_bytes;
-       gdouble remaining;
-
-       g_print ("[%s]\n", _("Disk Information"));
-
-       remaining_bytes = tracker_file_system_get_remaining_space (data_dir);
-       str = g_format_size (remaining_bytes);
-
-       remaining = tracker_file_system_get_remaining_space_percentage (data_dir);
-       g_print ("%s: %s (%3.2lf%%)\n",
-                _("Remaining space on database partition"),
-                str,
-                remaining);
-       g_free (str);
-       g_print ("\n\n");
-
-       /* 3. Size of dataset (tracker-stats), size of databases */
-       g_print ("[%s]\n", _("Data Set"));
-
-       for (d = g_dir_open (data_dir, 0, NULL); d != NULL;) {
-               const gchar *f;
-               gchar *path;
-               goffset size;
-
-               f = g_dir_read_name (d);
-               if (!f) {
-                       break;
-               }
-
-               if (g_str_has_suffix (f, ".txt")) {
-                       continue;
-               }
-
-               path = g_build_filename (data_dir, f, NULL);
-               size = tracker_file_get_size (path);
-               str = g_format_size (size);
-
-               g_print ("%s\n%s\n\n", path, str);
-               g_free (str);
-               g_free (path);
-       }
-       g_dir_close (d);
-       g_print ("\n");
-
-       /* 4. Current configuration (libtracker-fts, tracker-miner-fs, tracker-extract)
-        *    All txt files in ~/.cache/
-        */
-       GSList *all, *l;
-
-       g_print ("[%s]\n", _("Configuration"));
-
-       all = tracker_gsettings_get_all (NULL);
-
-       if (all) {
-               for (l = all; l; l = l->next) {
-                       ComponentGSettings *c = l->data;
-                       gchar **keys, **p;
-
-                       if (!c) {
-                               continue;
-                       }
-
-                       keys = g_settings_list_keys (c->settings);
-                       for (p = keys; p && *p; p++) {
-                               GVariant *v;
-                               gchar *printed;
-
-                               v = g_settings_get_value (c->settings, *p);
-                               printed = g_variant_print (v, FALSE);
-                               g_print ("%s.%s: %s\n", c->name, *p, printed);
-                               g_free (printed);
-                               g_variant_unref (v);
-                       }
-               }
-
-               tracker_gsettings_free (all);
-       } else {
-               g_print ("** %s **\n", _("No configuration was found"));
-       }
-       g_print ("\n\n");
-
-       g_print ("[%s]\n", _("States"));
-
-       for (d = g_dir_open (data_dir, 0, NULL); d != NULL;) {
-               const gchar *f;
-               gchar *path;
-               gchar *content = NULL;
-
-               f = g_dir_read_name (d);
-               if (!f) {
-                       break;
-               }
-
-               if (!g_str_has_suffix (f, ".txt")) {
-                       continue;
-               }
-
-               path = g_build_filename (data_dir, f, NULL);
-               if (g_file_get_contents (path, &content, NULL, NULL)) {
-                       /* Special case last-index.txt which is time() dump to file */
-                       if (g_str_has_suffix (path, "last-crawl.txt")) {
-                               guint64 then, now;
-
-                               now = (guint64) time (NULL);
-                               then = g_ascii_strtoull (content, NULL, 10);
-                               str = tracker_seconds_to_string (now - then, FALSE);
-
-                               g_print ("%s\n%s (%s)\n\n", path, content, str);
-                       } else {
-                               g_print ("%s\n%s\n\n", path, content);
-                       }
-                       g_free (content);
-               }
-               g_free (path);
-       }
-       g_dir_close (d);
-       g_print ("\n");
-
-       /* 5. Statistics about data (tracker-stats) */
-       TrackerSparqlConnection *connection;
-       GError *error = NULL;
-
-       g_print ("[%s]\n", _("Data Statistics"));
-
-       connection = tracker_sparql_connection_get (NULL, &error);
-
-       if (!connection) {
-               g_print ("** %s, %s **\n",
-                        _("No connection available"),
-                        error ? error->message : _("No error given"));
-               g_clear_error (&error);
-       } else {
-               TrackerSparqlCursor *cursor;
-
-               cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
-
-               if (error) {
-                       g_print ("** %s, %s **\n",
-                                _("Could not get statistics"),
-                                error ? error->message : _("No error given"));
-                       g_error_free (error);
-               } else {
-                       if (!cursor) {
-                               g_print ("** %s **\n",
-                                        _("No statistics were available"));
-                       } else {
-                               gint count = 0;
-
-                               while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-                                       g_print ("%s: %s\n",
-                                                tracker_sparql_cursor_get_string (cursor, 0, NULL),
-                                                tracker_sparql_cursor_get_string (cursor, 1, NULL));
-                                       count++;
-                               }
-
-                               if (count == 0) {
-                                       g_print ("%s\n",
-                                                _("Database is currently empty"));
-                               }
-
-                               g_object_unref (cursor);
-                       }
-               }
-       }
-
-       g_object_unref (connection);
-       g_print ("\n\n");
-
-       g_print ("\n");
-
-       g_free (data_dir);
-}
-
-void
-tracker_daemon_run_default (void)
-{
-       /* Enable status output in the default run */
-       status = TRUE;
-
-       tracker_daemon_run ();
-}
-
-gint
-tracker_daemon_run (void)
+static gint
+daemon_run (void)
 {
        TrackerMinerManager *manager;
 
@@ -1796,11 +1536,6 @@ tracker_daemon_run (void)
                }
        }
 
-       if (collect_debug_info) {
-               collect_debug ();
-               return EXIT_SUCCESS;
-       }
-
        if (get_log_verbosity || set_log_verbosity) {
                GType etype;
 
@@ -1973,136 +1708,51 @@ tracker_daemon_run (void)
                return EXIT_SUCCESS;
        }
 
-       if (backup) {
-               GDBusConnection *connection;
-               GDBusProxy *proxy;
-               GError *error = NULL;
-               GVariant *v;
-               gchar *uri;
-
-               if (!tracker_dbus_get_connection ("org.freedesktop.Tracker1",
-                                                 "/org/freedesktop/Tracker1/Backup",
-                                                 "org.freedesktop.Tracker1.Backup",
-                                                 G_DBUS_PROXY_FLAGS_NONE,
-                                                 &connection,
-                                                 &proxy)) {
-                       return EXIT_FAILURE;
-               }
-
-               uri = get_uri_from_arg (backup);
+       /* All known options have their own exit points */
+       g_warn_if_reached ();
 
-               g_print ("%s\n", _("Backing up database"));
-               g_print ("  %s\n", uri);
+       return EXIT_FAILURE;
+}
 
-               /* Backup/Restore can take some time */
-               g_dbus_proxy_set_default_timeout (proxy, G_MAXINT);
+static int
+daemon_run_default (void)
+{
+       /* Enable status output in the default run */
+       status = TRUE;
 
-               v = g_dbus_proxy_call_sync (proxy,
-                                           "Save",
-                                           g_variant_new ("(s)", uri),
-                                           G_DBUS_CALL_FLAGS_NONE,
-                                           -1,
-                                           NULL,
-                                           &error);
+       return daemon_run ();
+}
 
-               if (proxy) {
-                       g_object_unref (proxy);
-               }
+static gboolean
+daemon_options_enabled (void)
+{
+       return DAEMON_OPTIONS_ENABLED ();
+}
 
-               if (error) {
-                       g_critical ("%s, %s",
-                                   _("Could not backup database"),
-                                   error ? error->message : _("No error given"));
-                       g_clear_error (&error);
-                       g_free (uri);
+int
+tracker_daemon (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
 
-                       return EXIT_FAILURE;
-               }
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       g_option_context_set_summary (context, _("If no arguments are given, the status of the store and data 
miners is shown"));
 
-               if (v) {
-                       g_variant_unref (v);
-               }
+       argv[0] = "tracker daemon";
 
-               g_free (uri);
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
        }
 
-       if (restore) {
-               GDBusConnection *connection;
-               GDBusProxy *proxy;
-               GError *error = NULL;
-               GVariant *v;
-               gchar *uri;
-
-               if (!tracker_dbus_get_connection ("org.freedesktop.Tracker1",
-                                                 "/org/freedesktop/Tracker1/Backup",
-                                                 "org.freedesktop.Tracker1.Backup",
-                                                 G_DBUS_PROXY_FLAGS_NONE,
-                                                 &connection,
-                                                 &proxy)) {
-                       return EXIT_FAILURE;
-               }
-
-               uri = get_uri_from_arg (restore);
-
-               g_print ("%s\n", _("Restoring database from backup"));
-               g_print ("  %s\n", uri);
-
-               /* Backup/Restore can take some time */
-               g_dbus_proxy_set_default_timeout (proxy, G_MAXINT);
-
-               v = g_dbus_proxy_call_sync (proxy,
-                                           "Restore",
-                                           g_variant_new ("(s)", uri),
-                                           G_DBUS_CALL_FLAGS_NONE,
-                                           -1,
-                                           NULL,
-                                           &error);
-
-               if (proxy) {
-                       g_object_unref (proxy);
-               }
-
-               if (error) {
-                       g_critical ("%s, %s",
-                                   _("Could not backup database"),
-                                   error ? error->message : _("No error given"));
-                       g_clear_error (&error);
-                       g_free (uri);
-
-                       return EXIT_FAILURE;
-               }
-
-               if (v) {
-                       g_variant_unref (v);
-               }
+       g_option_context_free (context);
 
-               g_free (uri);
+       if (daemon_options_enabled ()) {
+               return daemon_run ();
        }
 
-       /* All known options have their own exit points */
-       g_warn_if_reached ();
-
-       return EXIT_FAILURE;
-}
-
-GOptionGroup *
-tracker_daemon_get_option_group (void)
-{
-       GOptionGroup *group;
-
-       /* Status options */
-       group = g_option_group_new ("Daemon",
-                                   _("Daemon options"),
-                                   _("Show daemon options"),
-                                   NULL,
-                                   NULL);
-       g_option_group_add_entries (group, entries);
-
-       return group;
-}
-
-gboolean
-tracker_daemon_options_enabled (void)
-{
-       return DAEMON_OPTIONS_ENABLED ();
+       return daemon_run_default ();
 }
diff --git a/src/tracker/tracker-daemon.h b/src/tracker/tracker-daemon.h
index b757fea..7d27139 100644
--- a/src/tracker/tracker-daemon.h
+++ b/src/tracker/tracker-daemon.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -17,14 +17,9 @@
  * 02110-1301, USA.
  */
 
-#include <glib.h>
-
 #ifndef __TRACKER_DAEMON_H__
 #define __TRACKER_DAEMON_H__
 
-gint          tracker_daemon_run               (void);
-void          tracker_daemon_run_default       (void);
-GOptionGroup *tracker_daemon_get_option_group  (void);
-gboolean      tracker_daemon_options_enabled   (void);
+int tracker_daemon (int argc, const char **argv);
 
 #endif /* __TRACKER_DAEMON_H__ */
diff --git a/src/tracker/tracker-index.c b/src/tracker/tracker-index.c
index edbb204..ae272f9 100644
--- a/src/tracker/tracker-index.c
+++ b/src/tracker/tracker-index.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -31,27 +31,87 @@
 #include <gio/gio.h>
 
 #include <libtracker-control/tracker-control.h>
+#include <libtracker-sparql/tracker-sparql.h>
 
 #include "tracker-index.h"
-
-static const gchar **reindex_mime_types;
-static gchar *index_file;
-
-#define INDEX_OPTIONS_ENABLED() \
-       (reindex_mime_types || index_file)
+#include "tracker-dbus.h"
+
+static gchar **reindex_mime_types;
+static gboolean index_file;
+static gboolean backup;
+static gboolean restore;
+static gboolean import;
+static gchar **filenames;
+
+#define INDEX_OPTIONS_ENABLED()          \
+       ((filenames && g_strv_length (filenames) > 0) || \
+        (index_file || \
+         backup || \
+         restore || \
+         import) || \
+        reindex_mime_types)
 
 static GOptionEntry entries[] = {
        { "reindex-mime-type", 'm', 0, G_OPTION_ARG_STRING_ARRAY, &reindex_mime_types,
          N_("Tell miners to reindex files which match the mime type supplied (for new extractors), use -m 
MIME1 -m MIME2"),
          N_("MIME") },
-       { "index-file", 'f', 0, G_OPTION_ARG_FILENAME, &index_file,
+       { "file", 'f', 0, G_OPTION_ARG_NONE, &index_file,
          N_("Tell miners to (re)index a given file"),
          N_("FILE") },
+       { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup,
+         N_("Backup current index / database to the file provided"),
+         NULL },
+       { "restore", 'o', 0, G_OPTION_ARG_NONE, &restore,
+         N_("Restore a database from a previous backup (see --backup)"),
+         NULL },
+       { "import", 'i', 0, G_OPTION_ARG_NONE, &import,
+         N_("Import a dataset from the provided file (in Turtle format)"),
+         NULL },
+       { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames,
+         N_("FILE"),
+         N_("FILE") },
        { NULL }
 };
 
-static gint
-miner_reindex_mime_types (const gchar **mime_types)
+static gboolean
+has_valid_uri_scheme (const gchar *uri)
+{
+       const gchar *s;
+
+       s = uri;
+
+       if (!g_ascii_isalpha (*s)) {
+               return FALSE;
+       }
+
+       do {
+               s++;
+       } while (g_ascii_isalnum (*s) || *s == '+' || *s == '.' || *s == '-');
+
+       return (*s == ':');
+}
+
+static gchar *
+get_uri_from_arg (const gchar *arg)
+{
+       gchar *uri;
+
+       /* support both, URIs and local file paths */
+       if (has_valid_uri_scheme (arg)) {
+               uri = g_strdup (arg);
+       } else {
+               GFile *file;
+
+               file = g_file_new_for_commandline_arg (arg);
+               uri = g_file_get_uri (file);
+               g_object_unref (file);
+       }
+
+       return uri;
+}
+
+static int
+reindex_mimes (void)
 {
        GError *error = NULL;
        TrackerMinerManager *manager;
@@ -66,7 +126,7 @@ miner_reindex_mime_types (const gchar **mime_types)
                return EXIT_FAILURE;
        }
 
-       tracker_miner_manager_reindex_by_mimetype (manager, (GStrv)reindex_mime_types, &error);
+       tracker_miner_manager_reindex_by_mimetype (manager, (GStrv) reindex_mime_types, &error);
        if (error) {
                g_printerr ("%s: %s\n",
                            _("Could not reindex mimetypes"),
@@ -82,11 +142,11 @@ miner_reindex_mime_types (const gchar **mime_types)
 }
 
 static gint
-miner_index_file (const gchar *filepath)
+index_or_reindex_file (void)
 {
        TrackerMinerManager *manager;
        GError *error = NULL;
-       GFile *file;
+       gchar **p;
 
        /* Auto-start the miners here if we need to */
        manager = tracker_miner_manager_new_full (TRUE, &error);
@@ -98,43 +158,211 @@ miner_index_file (const gchar *filepath)
                return EXIT_FAILURE;
        }
 
-       file = g_file_new_for_commandline_arg (index_file);
+       for (p = filenames; *p; p++) {
+               GFile *file;
 
-       tracker_miner_manager_index_file (manager, file, &error);
+               file = g_file_new_for_commandline_arg (*p);
+               tracker_miner_manager_index_file (manager, file, &error);
 
-       if (error) {
+               if (error) {
+                       g_printerr ("%s: %s\n",
+                                   _("Could not (re)index file"),
+                                   error->message);
+                       g_error_free (error);
+                       return EXIT_FAILURE;
+               }
+
+               g_print ("%s\n", _("(Re)indexing file was successful"));
+
+               g_object_unref (manager);
+               g_object_unref (file);
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int
+import_turtle_files (void)
+{
+       TrackerSparqlConnection *connection;
+       GError *error = NULL;
+       gchar **p;
+
+       connection = tracker_sparql_connection_get (NULL, &error);
+
+       if (!connection) {
                g_printerr ("%s: %s\n",
-                           _("Could not (re)index file"),
-                           error->message);
-               g_error_free (error);
+                           _("Could not establish a connection to Tracker"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
                return EXIT_FAILURE;
        }
 
-       g_print ("%s\n", _("(Re)indexing file was successful"));
+       for (p = filenames; *p; p++) {
+               GError *error = NULL;
+               GFile *file;
 
-       g_object_unref (manager);
-       g_object_unref (file);
+               g_print ("%s:'%s'\n",
+                        _("Importing Turtle file"),
+                        *p);
+
+               file = g_file_new_for_commandline_arg (*p);
+               tracker_sparql_connection_load (connection, file, NULL, &error);
+               g_object_unref (file);
+
+               if (error) {
+                       g_printerr ("  %s, %s\n",
+                                   _("Unable to import Turtle file"),
+                                   error->message);
+
+                       g_error_free (error);
+                       continue;
+               }
+
+               g_print ("  %s\n", _("Done"));
+               g_print ("\n");
+       }
+
+       g_object_unref (connection);
+
+       return EXIT_SUCCESS;
+}
+
+static int
+backup_index (void)
+{
+       GDBusConnection *connection;
+       GDBusProxy *proxy;
+       GError *error = NULL;
+       GVariant *v;
+       gchar *uri;
+
+       if (!tracker_dbus_get_connection ("org.freedesktop.Tracker1",
+                                         "/org/freedesktop/Tracker1/Backup",
+                                         "org.freedesktop.Tracker1.Backup",
+                                         G_DBUS_PROXY_FLAGS_NONE,
+                                         &connection,
+                                         &proxy)) {
+               return EXIT_FAILURE;
+       }
+
+       uri = get_uri_from_arg (filenames[0]);
+
+       g_print ("%s\n", _("Backing up database"));
+       g_print ("  %s\n", uri);
+
+       /* Backup/Restore can take some time */
+       g_dbus_proxy_set_default_timeout (proxy, G_MAXINT);
+
+       v = g_dbus_proxy_call_sync (proxy,
+                                   "Save",
+                                   g_variant_new ("(s)", uri),
+                                   G_DBUS_CALL_FLAGS_NONE,
+                                   -1,
+                                   NULL,
+                                   &error);
+
+       if (proxy) {
+               g_object_unref (proxy);
+       }
+
+       if (error) {
+               g_critical ("%s, %s",
+                           _("Could not backup database"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
+               g_free (uri);
+
+               return EXIT_FAILURE;
+       }
+
+       if (v) {
+               g_variant_unref (v);
+       }
+
+       g_free (uri);
 
        return EXIT_SUCCESS;
 }
 
-void
-tracker_index_run_default (void)
+static int
+restore_index (void)
 {
-       /* Set options in here we want to run by default with no args */
+       GDBusConnection *connection;
+       GDBusProxy *proxy;
+       GError *error = NULL;
+       GVariant *v;
+       gchar *uri;
+
+       if (!tracker_dbus_get_connection ("org.freedesktop.Tracker1",
+                                         "/org/freedesktop/Tracker1/Backup",
+                                         "org.freedesktop.Tracker1.Backup",
+                                         G_DBUS_PROXY_FLAGS_NONE,
+                                         &connection,
+                                         &proxy)) {
+               return EXIT_FAILURE;
+       }
 
-       tracker_index_run ();
+       uri = get_uri_from_arg (filenames[0]);
+
+       g_print ("%s\n", _("Restoring database from backup"));
+       g_print ("  %s\n", uri);
+
+       /* Backup/Restore can take some time */
+       g_dbus_proxy_set_default_timeout (proxy, G_MAXINT);
+
+       v = g_dbus_proxy_call_sync (proxy,
+                                   "Restore",
+                                   g_variant_new ("(s)", uri),
+                                   G_DBUS_CALL_FLAGS_NONE,
+                                   -1,
+                                   NULL,
+                                   &error);
+
+       if (proxy) {
+               g_object_unref (proxy);
+       }
+
+       if (error) {
+               g_critical ("%s, %s",
+                           _("Could not backup database"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
+               g_free (uri);
+
+               return EXIT_FAILURE;
+       }
+
+       if (v) {
+               g_variant_unref (v);
+       }
+
+       g_free (uri);
+
+       return EXIT_SUCCESS;
 }
 
-gint
-tracker_index_run (void)
+static int
+index_run (void)
 {
        if (reindex_mime_types) {
-               return miner_reindex_mime_types (reindex_mime_types);
+               return reindex_mimes ();
        }
 
        if (index_file) {
-               return miner_index_file (index_file);
+               return index_or_reindex_file ();
+       }
+
+       if (import) {
+               return import_turtle_files ();
+       }
+
+       if (backup) {
+               return backup_index ();
+       }
+
+       if (restore) {
+               return restore_index ();
        }
 
        /* All known options have their own exit points */
@@ -143,24 +371,86 @@ tracker_index_run (void)
        return EXIT_FAILURE;
 }
 
-GOptionGroup *
-tracker_index_get_option_group (void)
+static int
+index_run_default (void)
 {
-       GOptionGroup *group;
+       GOptionContext *context;
+       gchar *help;
 
-       /* Status options */
-       group = g_option_group_new ("Index",
-                                   _("Index options"),
-                                   _("Show index options"),
-                                   NULL,
-                                   NULL);
-       g_option_group_add_entries (group, entries);
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, TRUE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
 
-       return group;
+       return EXIT_FAILURE;
 }
 
-gboolean
-tracker_index_options_enabled (void)
+static gboolean
+index_options_enabled (void)
 {
        return INDEX_OPTIONS_ENABLED ();
 }
+
+int
+tracker_index (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+       const gchar *failed;
+       gint actions = 0;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker index";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (backup) {
+               actions++;
+       }
+
+       if (restore) {
+               actions++;
+       }
+
+       if (index_file) {
+               actions++;
+       }
+
+       if (import) {
+               actions++;
+       }
+
+       if (actions > 1) {
+               failed = _("Only one action (--backup, --restore, --index-file or --import) can be used at a 
time");
+       } else if (actions > 0 && (!filenames || g_strv_length (filenames) < 1)) {
+               failed = _("Missing one or more files which are required");
+       } else if ((backup || restore) && (filenames && g_strv_length (filenames) > 1)) {
+               failed = _("Only one file can be used with --backup and --restore");
+       } else if (actions > 0 && (reindex_mime_types && g_strv_length (reindex_mime_types) > 0)) {
+               failed = _("Actions (--backup, --restore, --index-file and --import) can not be used with 
--reindex-mime-type");
+       } else {
+               failed = NULL;
+       }
+
+       if (failed) {
+               g_printerr ("%s\n\n", failed);
+               return EXIT_FAILURE;
+       }
+
+       if (index_options_enabled ()) {
+               return index_run ();
+       }
+
+       return index_run_default ();
+}
diff --git a/src/tracker/tracker-index.h b/src/tracker/tracker-index.h
index e75f1d9..ae9d1d3 100644
--- a/src/tracker/tracker-index.h
+++ b/src/tracker/tracker-index.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -17,14 +17,9 @@
  * 02110-1301, USA.
  */
 
-#include <glib.h>
-
 #ifndef __TRACKER_INDEX_H__
 #define __TRACKER_INDEX_H__
 
-gint          tracker_index_run               (void);
-void          tracker_index_run_default       (void);
-GOptionGroup *tracker_index_get_option_group  (void);
-gboolean      tracker_index_options_enabled   (void);
+int tracker_index (int argc, const char **argv);
 
 #endif /* __TRACKER_INDEX_H__ */
diff --git a/src/tracker/tracker-info.c b/src/tracker/tracker-info.c
index aad5fd5..9ae62cb 100644
--- a/src/tracker/tracker-info.c
+++ b/src/tracker/tracker-info.c
@@ -2,6 +2,7 @@
  * Copyright (C) 2006, Jamie McCracken <jamiemcc gnome org>
  * Copyright (C) 2008-2010, Nokia <ivan frade nokia com>
  * Copyright (C) 2014, SoftAtHome <contact softathome com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -31,28 +32,19 @@
 
 #include <libtracker-sparql/tracker-sparql.h>
 
-#define ABOUT \
-       "Tracker " PACKAGE_VERSION "\n"
+#include "tracker-info.h"
+#include "tracker-sparql.h"
 
-#define LICENSE \
-       "This program is free software and comes without any warranty.\n" \
-       "It is licensed under version 2 or later of the General Public " \
-       "License which can be viewed at:\n" \
-       "\n" \
-       "  http://www.gnu.org/licenses/gpl.txt\n";
+#define INFO_OPTIONS_ENABLED() \
+       (filenames && g_strv_length (filenames) > 0);
 
 static gchar **filenames;
 static gboolean full_namespaces;
-static gboolean print_version;
 static gboolean plain_text_content;
 static gboolean resource_is_iri;
 static gboolean turtle;
 
 static GOptionEntry entries[] = {
-       { "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
-         N_("Print version"),
-         NULL,
-       },
        { "full-namespaces", 'f', 0, G_OPTION_ARG_NONE, &full_namespaces,
          N_("Show full namespaces (i.e. don't use nie:title, use full URLs)"),
          NULL,
@@ -81,29 +73,6 @@ static GOptionEntry entries[] = {
        { NULL }
 };
 
-static gchar *
-get_shorthand (GHashTable  *prefixes,
-               const gchar *namespace)
-{
-       gchar *hash;
-
-       hash = strrchr (namespace, '#');
-
-       if (hash) {
-               gchar *property;
-               const gchar *prefix;
-
-               property = hash + 1;
-               *hash = '\0';
-
-               prefix = g_hash_table_lookup (prefixes, namespace);
-
-               return g_strdup_printf ("%s:%s", prefix, property);
-       }
-
-       return g_strdup (namespace);
-}
-
 static gboolean
 has_valid_uri_scheme (const gchar *uri)
 {
@@ -122,68 +91,6 @@ has_valid_uri_scheme (const gchar *uri)
        return (*s == ':');
 }
 
-static GHashTable *
-get_prefixes (TrackerSparqlConnection *connection)
-{
-       TrackerSparqlCursor *cursor;
-       GError *error = NULL;
-       GHashTable *retval;
-       const gchar *query;
-
-       retval = g_hash_table_new_full (g_str_hash,
-                                       g_str_equal,
-                                       g_free,
-                                       g_free);
-
-       /* FIXME: Would like to get this in the same SPARQL that we
-        * use to get the info, but doesn't seem possible at the
-        * moment with the limited string manipulation features we
-        * support in SPARQL.
-        */
-       query = "SELECT ?ns ?prefix "
-               "WHERE {"
-               "  ?ns a tracker:Namespace ;"
-               "  tracker:prefix ?prefix "
-               "}";
-
-       cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
-
-       if (error) {
-               g_printerr ("%s, %s\n",
-                           _("Unable to retrieve namespace prefixes"),
-                           error->message);
-
-               g_error_free (error);
-               return retval;
-       }
-
-       if (!cursor) {
-               g_printerr ("%s\n", _("No namespace prefixes were returned"));
-               return retval;
-       }
-
-       while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-               const gchar *key, *value;
-
-               key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
-               value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
-
-               if (!key || !value) {
-                       continue;
-               }
-
-               g_hash_table_insert (retval,
-                                    g_strndup (key, strlen (key) - 1),
-                                    g_strdup (value));
-       }
-
-       if (cursor) {
-               g_object_unref (cursor);
-       }
-
-       return retval;
-}
-
 static inline void
 print_key_and_value (GHashTable  *prefixes,
                      const gchar *key,
@@ -194,7 +101,7 @@ print_key_and_value (GHashTable  *prefixes,
        } else {
                gchar *shorthand;
 
-               shorthand = get_shorthand (prefixes, key);
+               shorthand = tracker_sparql_get_shorthand (prefixes, key);
                g_print ("  '%s' = '%s'\n", shorthand, value);
                g_free (shorthand);
        }
@@ -262,7 +169,7 @@ format_urn (GHashTable  *prefixes,
        if (full_namespaces) {
                urn_out = g_strdup_printf ("<%s>", urn);
        } else {
-               gchar *shorthand = get_shorthand (prefixes, urn);
+               gchar *shorthand = tracker_sparql_get_shorthand (prefixes, urn);
 
                /* If the shorthand is the same as the urn passed, we
                 * assume it is a resource and pass it in as one,
@@ -301,7 +208,7 @@ print_turtle (gchar               *urn,
                subject = g_strdup (urn);
        } else {
                /* truncate subject */
-               subject = get_shorthand (prefixes, urn);
+               subject = tracker_sparql_get_shorthand (prefixes, urn);
        }
 
        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
@@ -341,53 +248,14 @@ print_turtle (gchar               *urn,
        g_free (subject);
 }
 
-int
-main (int argc, char **argv)
+static int
+info_run (void)
 {
        TrackerSparqlConnection *connection;
-       GOptionContext *context;
        GError *error = NULL;
        GHashTable *prefixes;
        gchar **p;
 
-       setlocale (LC_ALL, "");
-
-       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-       textdomain (GETTEXT_PACKAGE);
-
-       /* Translators: this messagge will apper immediately after the  */
-       /* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     */
-       context = g_option_context_new (_("- Get all information about one or more files"));
-
-       /* Translators: this message will appear after the usage string */
-       /* and before the list of options.                              */
-       g_option_context_add_main_entries (context, entries, NULL);
-       g_option_context_parse (context, &argc, &argv, NULL);
-
-       if (print_version) {
-               g_print ("\n" ABOUT "\n" LICENSE "\n");
-               g_option_context_free (context);
-
-               return EXIT_SUCCESS;
-       }
-
-       if (!filenames) {
-               gchar *help;
-
-               g_printerr ("%s\n\n",
-                           _("One or more files have not been specified"));
-
-               help = g_option_context_get_help (context, TRUE, NULL);
-               g_option_context_free (context);
-               g_printerr ("%s", help);
-               g_free (help);
-
-               return EXIT_FAILURE;
-       }
-
-       g_option_context_free (context);
-
        connection = tracker_sparql_connection_get (NULL, &error);
 
        if (!connection) {
@@ -398,7 +266,7 @@ main (int argc, char **argv)
                return EXIT_FAILURE;
        }
 
-       prefixes = get_prefixes (connection);
+       prefixes = tracker_sparql_get_prefixes ();
 
        /* print all prefixes if using turtle format and not showing full namespaces */
        if (turtle && !full_namespaces) {
@@ -516,3 +384,52 @@ main (int argc, char **argv)
 
        return EXIT_SUCCESS;
 }
+
+static int
+info_run_default (void)
+{
+       GOptionContext *context;
+       gchar *help;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, TRUE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
+
+       return EXIT_FAILURE;
+}
+
+static gboolean
+info_options_enabled (void)
+{
+       return INFO_OPTIONS_ENABLED ();
+}
+
+int
+tracker_info (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker info";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (info_options_enabled ()) {
+               return info_run ();
+       }
+
+       return info_run_default ();
+}
diff --git a/src/tracker/tracker-info.h b/src/tracker/tracker-info.h
new file mode 100644
index 0000000..7c16b2f
--- /dev/null
+++ b/src/tracker/tracker-info.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_INFO_H__
+#define __TRACKER_INFO_H__
+
+int tracker_info (int argc, const char **argv);
+
+#endif /* __TRACKER_INFO_H__ */
diff --git a/src/tracker/tracker-main.c b/src/tracker/tracker-main.c
index 508e15f..c3740b5 100644
--- a/src/tracker/tracker-main.c
+++ b/src/tracker/tracker-main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Lanedo GmbH <martyn lanedo com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -28,11 +28,15 @@
 
 #include <libtracker-common/tracker-common.h>
 
-#include "tracker-control.h"
 #include "tracker-daemon.h"
+#include "tracker-help.h"
 #include "tracker-index.h"
+#include "tracker-info.h"
 #include "tracker-reset.h"
-#include "tracker-help.h"
+#include "tracker-search.h"
+#include "tracker-sparql.h"
+#include "tracker-status.h"
+#include "tracker-tag.h"
 
 const char usage_string[] =
        "tracker [--version] [--help]\n"
@@ -54,51 +58,7 @@ const char about[] =
 static void print_usage (void);
 
 static int
-cmd_backup (int argc, const char **argv, const char *prefix)
-{
-       
-
-       return 0;
-}
-
-static int
-cmd_daemon (int argc, const char **argv, const char *prefix)
-{
-       GOptionContext *context;
-       GError *error = NULL;
-
-       context = g_option_context_new (NULL);
-       g_option_context_add_group (context, tracker_daemon_get_option_group ());
-
-       /* Common options */
-       /* g_option_context_add_main_entries (context, common_entries, NULL); */
-
-       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
-               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
-               g_error_free (error);
-               g_option_context_free (context);
-               return 1;
-       }
-
-       g_option_context_free (context);
-
-       if (tracker_daemon_options_enabled ()) {
-               return tracker_daemon_run ();
-       }
-
-       tracker_daemon_run_default ();
-
-       return 0;
-}
-
-static int
-cmd_import (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_help (int argc, const char **argv, const char *prefix)
+tracker_help (int argc, const char **argv)
 {
        if (!argv[0] || !argv[1]) {
                print_usage ();
@@ -111,115 +71,12 @@ cmd_help (int argc, const char **argv, const char *prefix)
 }
 
 static int
-cmd_info (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_index (int argc, const char **argv, const char *prefix)
-{
-       GOptionContext *context;
-       GError *error = NULL;
-
-       context = g_option_context_new (NULL);
-       g_option_context_add_group (context, tracker_index_get_option_group ());
-
-       /* Common options */
-       /* g_option_context_add_main_entries (context, common_entries, NULL); */
-
-       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
-               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
-               g_error_free (error);
-               g_option_context_free (context);
-               return 1;
-       }
-
-       g_option_context_free (context);
-
-       if (tracker_index_options_enabled ()) {
-               return tracker_index_run ();
-       }
-
-       tracker_index_run_default ();
-
-       return 0;
-}
-
-static int
-cmd_reset (int argc, const char **argv, const char *prefix)
-{
-       GOptionContext *context;
-       GError *error = NULL;
-
-       context = g_option_context_new (NULL);
-       g_option_context_add_group (context, tracker_reset_get_option_group ());
-
-       /* Common options */
-       /* g_option_context_add_main_entries (context, common_entries, NULL); */
-
-       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
-               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
-               g_error_free (error);
-               g_option_context_free (context);
-               return 1;
-       }
-
-       g_option_context_free (context);
-
-       if (tracker_reset_options_enabled ()) {
-               return tracker_reset_run ();
-       }
-
-       tracker_reset_run_default ();
-
-       return 0;
-}
-
-static int
-cmd_restore (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_search (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_sparql (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_stats (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_status (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_tag (int argc, const char **argv, const char *prefix)
-{
-       return 0;
-}
-
-static int
-cmd_version (int argc, const char **argv, const char *prefix)
+tracker_version (int argc, const char **argv)
 {
        puts (about);
        return 0;
 }
 
-
 /*
  * require working tree to be present -- anything uses this needs
  * RUN_SETUP for reading from the configuration file.
@@ -229,35 +86,29 @@ cmd_version (int argc, const char **argv, const char *prefix)
 
 struct cmd_struct {
        const char *cmd;
-       int (*fn)(int, const char **, const char *);
+       int (*fn)(int, const char **);
        int option;
        const char *help;
 };
 
 static struct cmd_struct commands[] = {
-       { "backup", cmd_backup, NEED_WORK_TREE, N_("Backup indexed content") },
-       { "daemon", cmd_daemon, NEED_WORK_TREE, N_("Start, stop, restart and list daemons responsible for 
indexing content") },
-       { "import", cmd_import, NEED_WORK_TREE, N_("Import a data set into the index") },
-       { "help", cmd_help, NEED_NOTHING, N_("Get help on how to use Tracker and any of these commands") },
-       { "info", cmd_info, NEED_WORK_TREE, N_("Show information known about local files or items indexed") 
}, 
-       { "index", cmd_index, NEED_NOTHING, N_("List, pause, resume and command data miners indexing 
content") },
-       { "reset", cmd_reset, NEED_NOTHING,  N_("Reset the index, configuration or replay journal") },
-       { "restore", cmd_restore, NEED_NOTHING, N_("Restore the index from a previous backup") },
-       { "search", cmd_search, NEED_WORK_TREE, N_("Search the index by RDF class") },
-       { "sparql", cmd_sparql, NEED_WORK_TREE, N_("Query and update the index using SPARQL or search and 
list ontology in use") },
-       { "stats", cmd_stats, NEED_WORK_TREE, N_("Show statistical information about indexed content") },
-       { "status", cmd_status, NEED_NOTHING, N_("Show the index status for the working tree") },
-       { "tag", cmd_tag, NEED_WORK_TREE, N_("Create, list or delete tags and related content") },
-       { "version", cmd_version, NEED_NOTHING, N_("Show the license and version in use") },
+       { "daemon", tracker_daemon, NEED_WORK_TREE, N_("Start, stop, restart and list daemons responsible for 
indexing content") },
+       { "help", tracker_help, NEED_NOTHING, N_("Get help on how to use Tracker and any of these commands") 
},
+       { "info", tracker_info, NEED_WORK_TREE, N_("Show information known about local files or items 
indexed") }, 
+       { "index", tracker_index, NEED_NOTHING, N_("List, pause, resume and command data miners indexing 
content") },
+       { "reset", tracker_reset, NEED_NOTHING,  N_("Reset the index, configuration or replay journal") },
+       { "search", tracker_search, NEED_WORK_TREE, N_("Search the index by RDF class") },
+       { "sparql", tracker_sparql, NEED_WORK_TREE, N_("Query and update the index using SPARQL or search and 
list ontology in use") },
+       { "status", tracker_status, NEED_NOTHING, N_("Show the index status for the working tree") },
+       { "tag", tracker_tag, NEED_WORK_TREE, N_("Create, list or delete tags and related content") },
+       { "version", tracker_version, NEED_NOTHING, N_("Show the license and version in use") },
 };
 
 static int
 run_builtin (struct cmd_struct *p, int argc, const char **argv)
 {
        int status, help;
-       const char *prefix;
 
-       prefix = NULL;
        help = argc == 2 && !strcmp (argv[1], "-h");
 
        if (!help && p->option & NEED_WORK_TREE) {
@@ -265,7 +116,7 @@ run_builtin (struct cmd_struct *p, int argc, const char **argv)
                /* FIXME: Finish */
        }
 
-       status = p->fn (argc, argv, prefix);
+       status = p->fn (argc, argv);
        if (status) {
                return status;
        }
@@ -294,6 +145,10 @@ handle_command (int argc, const char **argv)
 
                exit (run_builtin (p, argc, argv));
        }
+
+       g_printerr (_("'%s' is not a tracker command. See 'tracker --help'"), argv[0]);
+       g_printerr ("\n");
+       exit (EXIT_FAILURE);
 }
 
 static inline void
@@ -315,6 +170,7 @@ print_usage_list_cmds (void)
        }
 
        puts (_("Available tracker commands are:"));
+
        for (i = 0; i < G_N_ELEMENTS(commands); i++) {
                /* Don't list version in commands */
                if (!strcmp (commands[i].cmd, "version") ||
@@ -322,18 +178,18 @@ print_usage_list_cmds (void)
                        continue;
                }
 
-               g_print("   %s   ", commands[i].cmd);
+               g_print ("   %s   ", commands[i].cmd);
                mput_char (' ', longest - strlen (commands[i].cmd));
-               puts(_(commands[i].help));
+               puts (_(commands[i].help));
        }
 }
 
 static void
 print_usage (void)
 {
-       g_print("usage: %s\n\n", usage_string);
+       g_print ("usage: %s\n\n", usage_string);
        print_usage_list_cmds ();
-       g_print("\n%s\n", _(usage_more_info_string));
+       g_print ("\n%s\n", _(usage_more_info_string));
 }
 
 int
@@ -363,5 +219,5 @@ main (int argc, char **av)
 
        handle_command (argc, argv);
 
-       return 1;
+       return EXIT_FAILURE;
 }
diff --git a/src/tracker/tracker-process.c b/src/tracker/tracker-process.c
index 4057e14..7792730 100644
--- a/src/tracker/tracker-process.c
+++ b/src/tracker/tracker-process.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
diff --git a/src/tracker/tracker-process.h b/src/tracker/tracker-process.h
index bf8a0a4..1432da3 100644
--- a/src/tracker/tracker-process.h
+++ b/src/tracker/tracker-process.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2009, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
diff --git a/src/tracker/tracker-reset.c b/src/tracker/tracker-reset.c
index 57e9162..4c79137 100644
--- a/src/tracker/tracker-reset.c
+++ b/src/tracker/tracker-reset.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -44,13 +44,13 @@ static gboolean remove_config;
         remove_config)
 
 static GOptionEntry entries[] = {
-       { "hard-reset", 'r', 0, G_OPTION_ARG_NONE, &hard_reset,
+       { "hard", 'r', 0, G_OPTION_ARG_NONE, &hard_reset,
          N_("Kill all Tracker processes and remove all databases"),
          NULL },
-       { "soft-reset", 'e', 0, G_OPTION_ARG_NONE, &soft_reset,
-         N_("Same as --hard-reset but the backup & journal are restored after restart"),
+       { "soft", 'e', 0, G_OPTION_ARG_NONE, &soft_reset,
+         N_("Same as --hard but the backup & journal are restored after restart"),
          NULL },
-       { "remove-config", 'c', 0, G_OPTION_ARG_NONE, &remove_config,
+       { "config", 'c', 0, G_OPTION_ARG_NONE, &remove_config,
          N_("Remove all configuration files so they are re-generated on next start"),
          NULL },
        { NULL }
@@ -122,30 +122,20 @@ directory_foreach (GFile    *file,
        g_object_unref (enumerator);
 }
 
-void
-tracker_reset_run_default (void)
+static gint
+reset_run (void)
 {
-       /* Set options in here we want to run by default with no args */
-
-       tracker_reset_run ();
-}
-
-gint
-tracker_reset_run (void)
-{
-       TrackerProcessTypes kill_option = TRACKER_PROCESS_TYPE_NONE;
        GError *error = NULL;
 
        if (hard_reset && soft_reset) {
                g_printerr ("%s\n",
-                           _("You can not use the --hard-reset and --soft-reset arguments together"));
+                           _("You can not use the --hard and --soft arguments together"));
                return EXIT_FAILURE;
        }
 
+       /* KILL processes first... */
        if (hard_reset || soft_reset) {
-               /* Imply --kill */
-               kill_option = TRACKER_PROCESS_TYPE_ALL;
-               /* FIXME: Kill all before doing reset ... */
+               tracker_process_stop (TRACKER_PROCESS_TYPE_NONE, TRACKER_PROCESS_TYPE_ALL);
        }
 
        if (hard_reset || soft_reset) {
@@ -282,24 +272,51 @@ tracker_reset_run (void)
        return EXIT_FAILURE;
 }
 
-GOptionGroup *
-tracker_reset_get_option_group (void)
+static int
+reset_run_default (void)
 {
-       GOptionGroup *group;
+       GOptionContext *context;
+       gchar *help;
 
-       /* Status options */
-       group = g_option_group_new ("Reset",
-                                   _("Reset options"),
-                                   _("Show reset options"),
-                                   NULL,
-                                   NULL);
-       g_option_group_add_entries (group, entries);
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, FALSE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
 
-       return group;
+       return EXIT_FAILURE;
 }
 
-gboolean
-tracker_reset_options_enabled (void)
+static gboolean
+reset_options_enabled (void)
 {
        return RESET_OPTIONS_ENABLED ();
 }
+
+int
+tracker_reset (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker reset";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (reset_options_enabled ()) {
+               return reset_run ();
+       }
+
+       return reset_run_default ();
+}
diff --git a/src/tracker/tracker-reset.h b/src/tracker/tracker-reset.h
index d6bb2e4..4c1a9ef 100644
--- a/src/tracker/tracker-reset.h
+++ b/src/tracker/tracker-reset.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -17,14 +17,9 @@
  * 02110-1301, USA.
  */
 
-#include <glib.h>
-
 #ifndef __TRACKER_RESET_H__
 #define __TRACKER_RESET_H__
 
-gint          tracker_reset_run               (void);
-void          tracker_reset_run_default       (void);
-GOptionGroup *tracker_reset_get_option_group  (void);
-gboolean      tracker_reset_options_enabled   (void);
+int tracker_reset (int argc, const char **argv);
 
 #endif /* __TRACKER_RESET_H__ */
diff --git a/src/tracker/tracker-search.c b/src/tracker/tracker-search.c
index 9fd9846..395b694 100644
--- a/src/tracker/tracker-search.c
+++ b/src/tracker/tracker-search.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2009, Nokia <ivan frade nokia com>
  * Copyright (C) 2014, SoftAtHome <contact softathome com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -28,28 +29,11 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
-#include <libtracker-sparql/tracker-sparql.h>
-
 #include <libtracker-common/tracker-common.h>
+#include <libtracker-sparql/tracker-sparql.h>
 
-#define ABOUT    \
-       "Tracker " PACKAGE_VERSION "\n"
-
-#define LICENSE          \
-       "This program is free software and comes without any warranty.\n" \
-       "It is licensed under version 2 or later of the General Public " \
-       "License which can be viewed at:\n" \
-       "\n" \
-       "  http://www.gnu.org/licenses/gpl.txt\n";
-
-#define TITLE_BEGIN   "\033[32m"   /* Green */
-#define TITLE_END     "\033[0m"
-
-#define SNIPPET_BEGIN "\033[1;31m" /* Red */
-#define SNIPPET_END   "\033[0m"
-
-#define WARN_BEGIN    "\033[33m"   /* Yellow */
-#define WARN_END      "\033[0m"
+#include "tracker-color.h"
+#include "tracker-search.h"
 
 static gint limit = -1;
 static gint offset;
@@ -74,49 +58,24 @@ static gboolean feeds;
 static gboolean software;
 static gboolean software_categories;
 static gboolean bookmarks;
-static gboolean print_version;
 
-static GOptionEntry semantic_entries[] = {
-       { "limit", 'l', 0, G_OPTION_ARG_INT, &limit,
-         N_("Limit the number of results shown"),
-         "512"
-       },
-       { "offset", 'o', 0, G_OPTION_ARG_INT, &offset,
-         N_("Offset the results"),
-         "0"
-       },
-       { "or-operator", 'r', 0, G_OPTION_ARG_NONE, &or_operator,
-         N_("Use OR for search terms instead of AND (the default)"),
-         NULL
-       },
-       { "detailed", 'd', 0, G_OPTION_ARG_NONE, &detailed,
-         N_("Show URNs for results (doesn't apply to --music-albums, --music-artists, --feeds, --software, 
--software-categories)"),
-         NULL
-       },
-       { "all", 'a', 0, G_OPTION_ARG_NONE, &all,
-         N_("Return all non-existing matches too (i.e. include unmounted volumes)"),
-         NULL
-       },
-       { "disable-snippets", 0, 0, G_OPTION_ARG_NONE, &disable_snippets,
-         N_("Disable showing snippets with results. This is only shown for some categories, e.g. Documents, 
Music…"),
-         NULL,
-       },
-       { "disable-fts", 0, 0, G_OPTION_ARG_NONE, &disable_fts,
-         N_("Disable Full Text Search (FTS). Implies --disable-snippets"),
-         NULL,
-       },
-       { "disable-color", 0, 0, G_OPTION_ARG_NONE, &disable_color,
-         N_("Disable color when printing snippets and results"),
-         NULL,
-       },
-       { "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
-         N_("Print version"),
-         NULL
-       },
-       { NULL }
-};
-
-static GOptionEntry category_entries[] = {
+#define SEARCH_OPTIONS_ENABLED() \
+       (music_albums || music_artists || music_files || \
+        bookmarks || \
+        feeds || \
+        software || \
+        software_categories || \
+        image_files || \
+        video_files || \
+        document_files || \
+        emails || \
+        contacts || \
+        files || \
+        folders || \
+        (terms && g_strv_length (terms) > 0))
+
+static GOptionEntry entries[] = {
+       /* Search types */
        { "files", 'f', 0, G_OPTION_ARG_NONE, &files,
          N_("Search for files"),
          NULL
@@ -173,6 +132,42 @@ static GOptionEntry category_entries[] = {
          N_("Search for bookmarks (--all has no effect on this)"),
          NULL
        },
+
+       /* Semantic options */
+       { "limit", 'l', 0, G_OPTION_ARG_INT, &limit,
+         N_("Limit the number of results shown"),
+         "512"
+       },
+       { "offset", 'o', 0, G_OPTION_ARG_INT, &offset,
+         N_("Offset the results"),
+         "0"
+       },
+       { "or-operator", 'r', 0, G_OPTION_ARG_NONE, &or_operator,
+         N_("Use OR for search terms instead of AND (the default)"),
+         NULL
+       },
+       { "detailed", 'd', 0, G_OPTION_ARG_NONE, &detailed,
+         N_("Show URNs for results (doesn't apply to --music-albums, --music-artists, --feeds, --software, 
--software-categories)"),
+         NULL
+       },
+       { "all", 'a', 0, G_OPTION_ARG_NONE, &all,
+         N_("Return all non-existing matches too (i.e. include unmounted volumes)"),
+         NULL
+       },
+       { "disable-snippets", 0, 0, G_OPTION_ARG_NONE, &disable_snippets,
+         N_("Disable showing snippets with results. This is only shown for some categories, e.g. Documents, 
Music…"),
+         NULL,
+       },
+       { "disable-fts", 0, 0, G_OPTION_ARG_NONE, &disable_fts,
+         N_("Disable Full Text Search (FTS). Implies --disable-snippets"),
+         NULL,
+       },
+       { "disable-color", 0, 0, G_OPTION_ARG_NONE, &disable_color,
+         N_("Disable color when printing snippets and results"),
+         NULL,
+       },
+
+       /* Main arguments, the search terms */
        { G_OPTION_REMAINING, 0, 0,
          G_OPTION_ARG_STRING_ARRAY, &terms,
          N_("search terms"),
@@ -1514,82 +1509,11 @@ get_all_by_search (TrackerSparqlConnection *connection,
        return TRUE;
 }
 
-int
-main (int argc, char **argv)
+static gint
+search_run (void)
 {
        TrackerSparqlConnection *connection;
-       GOptionContext *context;
-       GOptionGroup *group;
        GError *error = NULL;
-       gchar *summary;
-
-       setlocale (LC_ALL, "");
-
-       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-       textdomain (GETTEXT_PACKAGE);
-
-       /* Translators: this messagge will apper immediately after the
-        * usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>
-        */
-       context = g_option_context_new (_("- Search for terms in all data"));
-
-       /* Translators: this message will appear after the usage string
-        * and before the list of options.
-        */
-       summary = g_strconcat (_("Applies an AND operator to all terms separated "
-                                "by a space (see --or-operator)"),
-                              "\n",
-                              "\n",
-                              _("This means if you search for 'foo' and 'bar', "
-                                "they must BOTH exist (unless you use --or-operator)"),
-                              NULL);
-       g_option_context_set_summary (context, summary);
-       g_option_context_add_main_entries (context, category_entries, NULL);
-
-       group = g_option_group_new ("search",
-                                   _("Search options"),
-                                   _("Show search options"),
-                                   NULL,
-                                   NULL);
-       g_option_group_add_entries (group, semantic_entries);
-       g_option_context_add_group (context, group);
-
-       g_option_context_parse (context, &argc, &argv, NULL);
-
-       g_free (summary);
-
-       if (print_version) {
-               g_print ("\n" ABOUT "\n" LICENSE "\n");
-               g_option_context_free (context);
-
-               return EXIT_SUCCESS;
-       }
-
-       if (!music_albums && !music_artists && !music_files &&
-           !bookmarks &&
-           !feeds &&
-           !software &&
-           !software_categories &&
-           !image_files &&
-           !video_files &&
-           !document_files &&
-           !emails &&
-           !contacts &&
-           !files && !folders &&
-           !terms) {
-               gchar *help;
-
-               g_printerr ("%s\n\n",
-                           _("Search terms are missing"));
-
-               help = g_option_context_get_help (context, TRUE, NULL);
-               g_option_context_free (context);
-               g_printerr ("%s", help);
-               g_free (help);
-
-               return EXIT_FAILURE;
-       }
 
        if (disable_fts) {
                disable_snippets = TRUE;
@@ -1647,8 +1571,6 @@ main (int argc, char **argv)
        disable_snippets = TRUE;
 #endif
 
-       g_option_context_free (context);
-
        connection = tracker_sparql_connection_get (NULL, &error);
 
        if (!connection) {
@@ -1811,5 +1733,57 @@ main (int argc, char **argv)
 
        g_object_unref (connection);
 
-       return EXIT_SUCCESS;
+       /* All known options have their own exit points */
+       g_warn_if_reached ();
+
+       return EXIT_FAILURE;
+}
+
+static int
+search_run_default (void)
+{
+       GOptionContext *context;
+       gchar *help;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, FALSE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
+
+       return EXIT_FAILURE;
+}
+
+static gboolean
+search_options_enabled (void)
+{
+       return SEARCH_OPTIONS_ENABLED ();
+}
+
+int
+tracker_search (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker search";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (search_options_enabled ()) {
+               return search_run ();
+       }
+
+       return search_run_default ();
 }
diff --git a/src/tracker/tracker-search.h b/src/tracker/tracker-search.h
new file mode 100644
index 0000000..8decf7c
--- /dev/null
+++ b/src/tracker/tracker-search.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_SEARCH_H__
+#define __TRACKER_SEARCH_H__
+
+int tracker_search (int argc, const char **argv);
+
+#endif /* __TRACKER_SEARCH_H__ */
diff --git a/src/tracker/tracker-sparql.c b/src/tracker/tracker-sparql.c
index 2e41fb4..e428b64 100644
--- a/src/tracker/tracker-sparql.c
+++ b/src/tracker/tracker-sparql.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2009, Nokia <ivan frade nokia com>
  * Copyright (C) 2014, Softathome <philippe judge softathome com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -30,18 +31,21 @@
 
 #include <libtracker-sparql/tracker-sparql.h>
 
-#define ABOUT \
-       "Tracker " PACKAGE_VERSION "\n"
-
-#define LICENSE \
-       "This program is free software and comes without any warranty.\n" \
-       "It is licensed under version 2 or later of the General Public " \
-       "License which can be viewed at:\n" \
-       "\n" \
-       "  http://www.gnu.org/licenses/gpl.txt\n";
-
-#define SNIPPET_BEGIN "\033[1;31m" /* Red */
-#define SNIPPET_END   "\033[0m"
+#include "tracker-sparql.h"
+#include "tracker-color.h"
+
+#define SPARQL_OPTIONS_ENABLED() \
+       (list_classes || \
+        list_class_prefixes || \
+        list_properties || \
+        list_notifies || \
+        list_indexes || \
+        tree || \
+        search || \
+        get_shorthand || \
+        get_longhand || \
+        file || \
+        query)
 
 typedef struct _NodeData NodeData;
 typedef struct _NodeFindData NodeFindData;
@@ -91,12 +95,11 @@ static gchar *list_properties;
 static gchar *list_notifies;
 static gchar *list_indexes;
 static gchar *tree;
-static gboolean print_version;
 static gchar *get_shorthand;
 static gchar *get_longhand;
 static gchar *search;
 
-static GOptionEntry   entries[] = {
+static GOptionEntry entries[] = {
        { "file", 'f', 0, G_OPTION_ARG_FILENAME, &file,
          N_("Path to use to run a query or update from file"),
          N_("FILE"),
@@ -145,22 +148,28 @@ static GOptionEntry   entries[] = {
          N_("Returns the full namespace for a class."),
          N_("CLASS"),
        },
-
-       { "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
-         N_("Print version"),
-         NULL,
-       },
        { NULL }
 };
 
-static GHashTable *
-get_prefixes (TrackerSparqlConnection *connection)
+GHashTable *
+tracker_sparql_get_prefixes (void)
 {
+       TrackerSparqlConnection *connection;
        TrackerSparqlCursor *cursor;
        GError *error = NULL;
        GHashTable *retval;
        const gchar *query;
 
+       connection = tracker_sparql_connection_get (NULL, &error);
+
+       if (!connection) {
+               g_printerr ("%s: %s\n",
+                           _("Could not establish a connection to Tracker"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
+               return NULL;
+       }
+
        retval = g_hash_table_new_full (g_str_hash,
                                        g_str_equal,
                                        g_free,
@@ -179,6 +188,8 @@ get_prefixes (TrackerSparqlConnection *connection)
 
        cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
 
+       g_object_unref (connection);
+
        if (error) {
                g_printerr ("%s, %s\n",
                            _("Unable to retrieve namespace prefixes"),
@@ -325,10 +336,9 @@ parse_tree (const gchar  *option_name,
        return TRUE;
 }
 
-
-static gchar *
-get_longhand_str (GHashTable  *prefixes,
-                  const gchar *shorthand)
+gchar *
+tracker_sparql_get_longhand (GHashTable  *prefixes,
+                             const gchar *shorthand)
 {
        gchar *colon, *namespace;
 
@@ -365,32 +375,26 @@ get_longhand_str (GHashTable  *prefixes,
        return namespace;
 }
 
-static gchar *
-get_shorthand_str (GHashTable  *prefixes,
-                   const gchar *longhand)
+gchar *
+tracker_sparql_get_shorthand (GHashTable  *prefixes,
+                              const gchar *longhand)
 {
-       gchar *hash, *namespace;
+       gchar *hash;
 
-       namespace = g_strdup (longhand);
-       hash = strrchr (namespace, '#');
+       hash = strrchr (longhand, '#');
 
        if (hash) {
-               gchar *shorthand;
                gchar *property;
                const gchar *prefix;
 
                property = hash + 1;
                *hash = '\0';
 
-               prefix = g_hash_table_lookup (prefixes, namespace);
-               shorthand = g_strdup_printf ("%s:%s", prefix, property);
-               g_free (namespace);
+               prefix = g_hash_table_lookup (prefixes, longhand);
 
-               return shorthand;
+               return g_strdup_printf ("%s:%s", prefix, property);
        }
 
-       g_free (namespace);
-
        return g_strdup (longhand);
 }
 
@@ -424,7 +428,7 @@ get_shorthand_str_for_offsets (GHashTable  *prefixes,
                        continue;
                }
 
-               shorthand = get_shorthand_str (prefixes, property);
+               shorthand = tracker_sparql_get_shorthand (prefixes, property);
 
                if (!shorthand) {
                        shorthand = g_strdup (property);
@@ -868,7 +872,7 @@ tree_print_foreach (GNode    *node,
        shorthand = NULL;
 
        if (pd->prefixes) {
-               shorthand = get_shorthand_str (pd->prefixes, nd->class);
+               shorthand = tracker_sparql_get_shorthand (pd->prefixes, nd->class);
        }
 
        depth = g_node_depth (node);
@@ -936,11 +940,11 @@ tree_get (TrackerSparqlConnection *connection,
        root = tree_new ();
 
        /* Get shorthand prefixes for printing / filtering */
-       prefixes = get_prefixes (connection);
+       prefixes = tracker_sparql_get_prefixes ();
 
        /* Is class_lookup a shothand string, e.g. nfo:FileDataObject? */
        if (class_lookup && *class_lookup && strchr (class_lookup, ':')) {
-               class_lookup_longhand = get_longhand_str (prefixes, class_lookup);
+               class_lookup_longhand = tracker_sparql_get_longhand (prefixes, class_lookup);
        } else {
                class_lookup_longhand = g_strdup (class_lookup);
        }
@@ -1027,7 +1031,7 @@ tree_get (TrackerSparqlConnection *connection,
                        const gchar *property = tracker_sparql_cursor_get_string (properties, 1, NULL);
                        gchar *property_lookup_shorthand;
 
-                       property_lookup_shorthand = get_shorthand_str (prefixes, property);
+                       property_lookup_shorthand = tracker_sparql_get_shorthand (prefixes, property);
                        tree_add_property (root, class, property_lookup_shorthand);
                        g_free (property_lookup_shorthand);
                }
@@ -1059,59 +1063,12 @@ tree_get (TrackerSparqlConnection *connection,
        return EXIT_SUCCESS;
 }
 
-int
-main (int argc, char **argv)
+static int
+sparql_run (void)
 {
        TrackerSparqlConnection *connection;
        TrackerSparqlCursor *cursor;
-       GOptionContext *context;
        GError *error = NULL;
-       const gchar *error_message;
-
-       setlocale (LC_ALL, "");
-
-       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-       textdomain (GETTEXT_PACKAGE);
-
-       context = g_option_context_new (_("- Query or update using SPARQL"));
-
-       g_option_context_add_main_entries (context, entries, NULL);
-       g_option_context_parse (context, &argc, &argv, NULL);
-
-       if (print_version) {
-               g_print ("\n" ABOUT "\n" LICENSE "\n");
-               g_option_context_free (context);
-
-               return EXIT_SUCCESS;
-       }
-
-       if (!list_classes && !list_class_prefixes && !list_properties &&
-           !list_notifies && !list_indexes && !tree && !search &&
-           !get_shorthand && !get_longhand && !file && !query) {
-               error_message = _("An argument must be supplied");
-       } else if (file && query) {
-               error_message = _("File and query can not be used together");
-       } else if (list_properties && list_properties[0] == '\0' && !tree) {
-               error_message = _("The --list-properties argument can only be empty when used with the --tree 
argument");
-       } else {
-               error_message = NULL;
-       }
-
-       if (error_message) {
-               gchar *help;
-
-               g_printerr ("%s\n\n", error_message);
-
-               help = g_option_context_get_help (context, TRUE, NULL);
-               g_option_context_free (context);
-               g_printerr ("%s", help);
-               g_free (help);
-
-               return EXIT_FAILURE;
-       }
-
-       g_option_context_free (context);
 
        connection = tracker_sparql_connection_get (NULL, &error);
 
@@ -1357,10 +1314,10 @@ main (int argc, char **argv)
        }
 
        if (get_shorthand) {
-               GHashTable *prefixes = get_prefixes (connection);
+               GHashTable *prefixes = tracker_sparql_get_prefixes ();
                gchar *result;
 
-               result = get_shorthand_str (prefixes, get_shorthand);
+               result = tracker_sparql_get_shorthand (prefixes, get_shorthand);
                g_print ("%s\n", result);
                g_free (result);
 
@@ -1370,10 +1327,10 @@ main (int argc, char **argv)
        }
 
        if (get_longhand) {
-               GHashTable *prefixes = get_prefixes (connection);
+               GHashTable *prefixes = tracker_sparql_get_prefixes ();
                gchar *result;
 
-               result = get_longhand_str (prefixes, get_longhand);
+               result = tracker_sparql_get_longhand (prefixes, get_longhand);
                g_print ("%s\n", result);
                g_free (result);
 
@@ -1461,7 +1418,7 @@ main (int argc, char **argv)
                        GHashTable *prefixes = NULL;
 
                        if (strstr (query, "fts:offsets")) {
-                               prefixes = get_prefixes (connection);
+                               prefixes = tracker_sparql_get_prefixes ();
                        }
 
                        cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
@@ -1493,3 +1450,65 @@ main (int argc, char **argv)
        return EXIT_SUCCESS;
 }
 
+static int
+sparql_run_default (void)
+{
+       GOptionContext *context;
+       gchar *help;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, FALSE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
+
+       return EXIT_FAILURE;
+}
+
+static gboolean
+sparql_options_enabled (void)
+{
+       return SPARQL_OPTIONS_ENABLED ();
+}
+
+int
+tracker_sparql (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+       const gchar *failed;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker sparql";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (file && query) {
+               failed = _("File and query can not be used together");
+       } else if (list_properties && list_properties[0] == '\0' && !tree) {
+               failed = _("The --list-properties argument can only be empty when used with the --tree 
argument");
+       } else {
+               failed = NULL;
+       }
+
+       if (failed) {
+               g_printerr ("%s\n\n", failed);
+               return EXIT_FAILURE;
+       }
+
+       if (sparql_options_enabled ()) {
+               return sparql_run ();
+       }
+
+       return sparql_run_default ();
+}
diff --git a/src/tracker/tracker-sparql.h b/src/tracker/tracker-sparql.h
new file mode 100644
index 0000000..c8601dd
--- /dev/null
+++ b/src/tracker/tracker-sparql.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_SPARQL_H__
+#define __TRACKER_SPARQL_H__
+
+#include <glib.h>
+
+#include <libtracker-sparql/tracker-sparql.h>
+
+int         tracker_sparql               (int                       argc,
+                                          const char              **argv);
+
+GHashTable *tracker_sparql_get_prefixes  (void);
+gchar *     tracker_sparql_get_longhand  (GHashTable               *prefixes,
+                                          const gchar              *shorthand);
+gchar *     tracker_sparql_get_shorthand (GHashTable               *prefixes,
+                                          const gchar              *longhand);
+
+#endif /* __TRACKER_SPARQL_H__ */
diff --git a/src/tracker/tracker-status.c b/src/tracker/tracker-status.c
new file mode 100644
index 0000000..69b044c
--- /dev/null
+++ b/src/tracker/tracker-status.c
@@ -0,0 +1,716 @@
+/*
+ * Copyright (C) 2006, Jamie McCracken <jamiemcc gnome org>
+ * Copyright (C) 2008, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <locale.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include <libtracker-common/tracker-common.h>
+#include <libtracker-sparql/tracker-sparql.h>
+#include <libtracker-control/tracker-control.h>
+
+#include "tracker-status.h"
+#include "tracker-config.h"
+
+#define STATUS_OPTIONS_ENABLED()         \
+       (show_stat || \
+        collect_debug_info)
+
+static gboolean show_stat;
+static gboolean show_all;
+static gboolean collect_debug_info;
+static gchar **terms;
+
+static GHashTable *common_rdf_types;
+
+static GOptionEntry entries[] = {
+       { "stat", 'a', 0, G_OPTION_ARG_NONE, &show_stat,
+         N_("Show statistics for current index / data set"),
+         NULL
+       },
+       { "all", 'a', 0, G_OPTION_ARG_NONE, &show_all,
+         N_("Show statistics about ALL RDF classes, not just common ones which is the default (implied by 
search terms)"),
+         NULL
+       },
+       { "collect-debug-info", 0, 0, G_OPTION_ARG_NONE, &collect_debug_info,
+         N_("Collect debug information useful for problem reporting and investigation, results are output to 
terminal"),
+         NULL },
+       { G_OPTION_REMAINING, 0, 0,
+         G_OPTION_ARG_STRING_ARRAY, &terms,
+         N_("search terms"),
+         N_("EXPRESSION") },
+       { NULL }
+};
+
+static gboolean
+get_common_rdf_types (void)
+{
+       const gchar *extractors_dir, *name;
+       GList *files = NULL, *l;
+       GError *error = NULL;
+       GDir *dir;
+
+       if (common_rdf_types) {
+               return TRUE;
+       }
+
+       extractors_dir = g_getenv ("TRACKER_EXTRACTOR_RULES_DIR");
+       if (G_LIKELY (extractors_dir == NULL)) {
+               extractors_dir = TRACKER_EXTRACTOR_RULES_DIR;
+       }
+
+       dir = g_dir_open (extractors_dir, 0, &error);
+
+       if (!dir) {
+               g_error ("Error opening extractor rules directory: %s", error->message);
+               g_error_free (error);
+               return FALSE;
+       }
+
+       common_rdf_types = g_hash_table_new_full (g_str_hash,
+                                                 g_str_equal,
+                                                 g_free,
+                                                 NULL);
+
+       while ((name = g_dir_read_name (dir)) != NULL) {
+               files = g_list_insert_sorted (files, (gpointer) name, (GCompareFunc) g_strcmp0);
+       }
+
+       for (l = files; l; l = l->next) {
+               GKeyFile *key_file;
+               const gchar *name;
+               gchar *path;
+
+               name = l->data;
+
+               if (!g_str_has_suffix (l->data, ".rule")) {
+                       continue;
+               }
+
+               path = g_build_filename (extractors_dir, name, NULL);
+               key_file = g_key_file_new ();
+
+               g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, &error);
+
+               if (G_UNLIKELY (error)) {
+                       g_clear_error (&error);
+               } else {
+                       gchar **rdf_types;
+                       gsize n_rdf_types;
+
+                       rdf_types = g_key_file_get_string_list (key_file, "ExtractorRule", 
"FallbackRdfTypes", &n_rdf_types, &error);
+
+                       if (G_UNLIKELY (error)) {
+                               g_clear_error (&error);
+                       } else if (rdf_types != NULL) {
+                               gint i;
+
+                               for (i = 0; i < n_rdf_types; i++) {
+                                       const gchar *rdf_type = rdf_types[i];
+
+                                       g_hash_table_insert (common_rdf_types, g_strdup (rdf_type), 
GINT_TO_POINTER(TRUE));
+                               }
+                       }
+
+                       g_strfreev (rdf_types);
+               }
+
+               g_key_file_free (key_file);
+               g_free (path);
+       }
+
+       g_list_free (files);
+       g_dir_close (dir);
+
+       /* Make sure some additional RDF types are shown which are not
+        * fall backs.
+        */
+       g_hash_table_insert (common_rdf_types, g_strdup ("rdfs:Resource"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("rdfs:Class"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("nfo:FileDataObject"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("nfo:Folder"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("nfo:Executable"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("nco:Contact"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("nao:Tag"), GINT_TO_POINTER(TRUE));
+       g_hash_table_insert (common_rdf_types, g_strdup ("tracker:Volume"), GINT_TO_POINTER(TRUE));
+
+       return TRUE;
+}
+
+static int
+status_stat (void)
+{
+       TrackerSparqlConnection *connection;
+       TrackerSparqlCursor *cursor;
+       GError *error = NULL;
+
+       connection = tracker_sparql_connection_get (NULL, &error);
+
+       if (!connection) {
+               g_printerr ("%s: %s\n",
+                           _("Could not establish a connection to Tracker"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
+               return EXIT_FAILURE;
+       }
+
+       cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
+
+       g_object_unref (connection);
+
+       if (error) {
+               g_printerr ("%s, %s\n",
+                           _("Could not get Tracker statistics"),
+                           error->message);
+               g_error_free (error);
+               return EXIT_FAILURE;
+       }
+
+       /* We use search terms on ALL ontologies not just common ones */
+       if (terms && g_strv_length (terms) > 0) {
+               show_all = TRUE;
+       }
+
+       if (!cursor) {
+               g_print ("%s\n", _("No statistics available"));
+       } else {
+               GString *output;
+
+               output = g_string_new ("");
+
+               if (!show_all) {
+                       get_common_rdf_types ();
+               }
+
+               while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+                       const gchar *rdf_type;
+                       const gchar *rdf_type_count;
+
+                       rdf_type = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+                       rdf_type_count = tracker_sparql_cursor_get_string (cursor, 1, NULL);
+
+                       if (!show_all && !g_hash_table_contains (common_rdf_types, rdf_type)) {
+                               continue;
+                       }
+
+                       if (terms) {
+                               gint i, n_terms;
+                               gboolean show_rdf_type = FALSE;
+
+                               n_terms = g_strv_length (terms);
+
+                               for (i = 0;
+                                    i < n_terms && !show_rdf_type;
+                                    i++) {
+                                       show_rdf_type = g_str_match_string (terms[i], rdf_type, TRUE);
+                               }
+
+                               if (!show_rdf_type) {
+                                       continue;
+                               }
+                       }
+
+                       g_string_append_printf (output,
+                                               "  %s = %s\n",
+                                               rdf_type,
+                                               rdf_type_count);
+               }
+
+               if (output->len > 0) {
+                       /* To translators: This is to say there are no
+                        * statistics found. We use a "Statistics:
+                        * None" with multiple print statements */
+                       g_string_prepend (output, "\n");
+                       g_string_prepend (output, _("Statistics:"));
+               } else {
+                       g_string_append_printf (output,
+                                               "  %s\n", _("None"));
+               }
+
+               g_print ("%s\n", output->str);
+               g_string_free (output, TRUE);
+
+               if (common_rdf_types) {
+                       g_hash_table_unref (common_rdf_types);
+               }
+
+               g_object_unref (cursor);
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int
+collect_debug (void)
+{
+       /* What to collect?
+        * This is based on information usually requested from maintainers to users.
+        *
+        * 1. Package details, e.g. version.
+        * 2. Disk size, space left, type (SSD/etc)
+        * 3. Size of dataset (tracker-stats), size of databases
+        * 4. Current configuration (libtracker-fts, tracker-miner-fs, tracker-extract)
+        *    All txt files in ~/.cache/
+        * 5. Statistics about data (tracker-stats)
+        */
+
+       GDir *d;
+       gchar *data_dir;
+       gchar *str;
+
+       data_dir = g_build_filename (g_get_user_cache_dir (), "tracker", NULL);
+
+       /* 1. Package details, e.g. version. */
+       g_print ("[Package Details]\n");
+       g_print ("%s: " PACKAGE_VERSION "\n", _("Version"));
+       g_print ("\n\n");
+
+       /* 2. Disk size, space left, type (SSD/etc) */
+       guint64 remaining_bytes;
+       gdouble remaining;
+
+       g_print ("[%s]\n", _("Disk Information"));
+
+       remaining_bytes = tracker_file_system_get_remaining_space (data_dir);
+       str = g_format_size (remaining_bytes);
+
+       remaining = tracker_file_system_get_remaining_space_percentage (data_dir);
+       g_print ("%s: %s (%3.2lf%%)\n",
+                _("Remaining space on database partition"),
+                str,
+                remaining);
+       g_free (str);
+       g_print ("\n\n");
+
+       /* 3. Size of dataset (tracker-stats), size of databases */
+       g_print ("[%s]\n", _("Data Set"));
+
+       for (d = g_dir_open (data_dir, 0, NULL); d != NULL;) {
+               const gchar *f;
+               gchar *path;
+               goffset size;
+
+               f = g_dir_read_name (d);
+               if (!f) {
+                       break;
+               }
+
+               if (g_str_has_suffix (f, ".txt")) {
+                       continue;
+               }
+
+               path = g_build_filename (data_dir, f, NULL);
+               size = tracker_file_get_size (path);
+               str = g_format_size (size);
+
+               g_print ("%s\n%s\n\n", path, str);
+               g_free (str);
+               g_free (path);
+       }
+       g_dir_close (d);
+       g_print ("\n");
+
+       /* 4. Current configuration (libtracker-fts, tracker-miner-fs, tracker-extract)
+        *    All txt files in ~/.cache/
+        */
+       GSList *all, *l;
+
+       g_print ("[%s]\n", _("Configuration"));
+
+       all = tracker_gsettings_get_all (NULL);
+
+       if (all) {
+               for (l = all; l; l = l->next) {
+                       ComponentGSettings *c = l->data;
+                       gchar **keys, **p;
+
+                       if (!c) {
+                               continue;
+                       }
+
+                       keys = g_settings_list_keys (c->settings);
+                       for (p = keys; p && *p; p++) {
+                               GVariant *v;
+                               gchar *printed;
+
+                               v = g_settings_get_value (c->settings, *p);
+                               printed = g_variant_print (v, FALSE);
+                               g_print ("%s.%s: %s\n", c->name, *p, printed);
+                               g_free (printed);
+                               g_variant_unref (v);
+                       }
+               }
+
+               tracker_gsettings_free (all);
+       } else {
+               g_print ("** %s **\n", _("No configuration was found"));
+       }
+       g_print ("\n\n");
+
+       g_print ("[%s]\n", _("States"));
+
+       for (d = g_dir_open (data_dir, 0, NULL); d != NULL;) {
+               const gchar *f;
+               gchar *path;
+               gchar *content = NULL;
+
+               f = g_dir_read_name (d);
+               if (!f) {
+                       break;
+               }
+
+               if (!g_str_has_suffix (f, ".txt")) {
+                       continue;
+               }
+
+               path = g_build_filename (data_dir, f, NULL);
+               if (g_file_get_contents (path, &content, NULL, NULL)) {
+                       /* Special case last-index.txt which is time() dump to file */
+                       if (g_str_has_suffix (path, "last-crawl.txt")) {
+                               guint64 then, now;
+
+                               now = (guint64) time (NULL);
+                               then = g_ascii_strtoull (content, NULL, 10);
+                               str = tracker_seconds_to_string (now - then, FALSE);
+
+                               g_print ("%s\n%s (%s)\n\n", path, content, str);
+                       } else {
+                               g_print ("%s\n%s\n\n", path, content);
+                       }
+                       g_free (content);
+               }
+               g_free (path);
+       }
+       g_dir_close (d);
+       g_print ("\n");
+
+       /* 5. Statistics about data (tracker-stats) */
+       TrackerSparqlConnection *connection;
+       GError *error = NULL;
+
+       g_print ("[%s]\n", _("Data Statistics"));
+
+       connection = tracker_sparql_connection_get (NULL, &error);
+
+       if (!connection) {
+               g_print ("** %s, %s **\n",
+                        _("No connection available"),
+                        error ? error->message : _("No error given"));
+               g_clear_error (&error);
+       } else {
+               TrackerSparqlCursor *cursor;
+
+               cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
+
+               if (error) {
+                       g_print ("** %s, %s **\n",
+                                _("Could not get statistics"),
+                                error ? error->message : _("No error given"));
+                       g_error_free (error);
+               } else {
+                       if (!cursor) {
+                               g_print ("** %s **\n",
+                                        _("No statistics were available"));
+                       } else {
+                               gint count = 0;
+
+                               while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+                                       g_print ("%s: %s\n",
+                                                tracker_sparql_cursor_get_string (cursor, 0, NULL),
+                                                tracker_sparql_cursor_get_string (cursor, 1, NULL));
+                                       count++;
+                               }
+
+                               if (count == 0) {
+                                       g_print ("%s\n",
+                                                _("Database is currently empty"));
+                               }
+
+                               g_object_unref (cursor);
+                       }
+               }
+       }
+
+       g_object_unref (connection);
+       g_print ("\n\n");
+
+       g_print ("\n");
+
+       g_free (data_dir);
+
+       return EXIT_SUCCESS;
+}
+
+static int
+status_run (void)
+{
+       if (show_stat) {
+               return status_stat ();
+       }
+
+       if (collect_debug_info) {
+               return collect_debug ();
+       }
+
+       /* All known options have their own exit points */
+       g_warn_if_reached ();
+
+       return EXIT_FAILURE;
+}
+
+static int
+get_file_and_folder_count (int *files,
+                           int *folders)
+{
+       TrackerSparqlConnection *connection;
+       TrackerSparqlCursor *cursor;
+       GError *error = NULL;
+
+       connection = tracker_sparql_connection_get (NULL, &error);
+
+       if (files) {
+               *files = 0;
+       }
+
+       if (folders) {
+               *folders = 0;
+       }
+
+       if (!connection) {
+               g_printerr ("%s: %s\n",
+                           _("Could not establish a connection to Tracker"),
+                           error ? error->message : _("No error given"));
+               g_clear_error (&error);
+               return EXIT_FAILURE;
+       }
+
+       if (files) {
+               const gchar query[] =
+                       "\nSELECT COUNT(?file) "
+                       "\nWHERE { "
+                       "\n  ?file a nfo:FileDataObject ;"
+                       "\n        tracker:available true ."
+                       "\n  FILTER (?file != nfo:Folder) "
+                       "\n}";
+
+               cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+
+               if (error || !tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+                       g_printerr ("%s, %s\n",
+                                   _("Could not get basic status for Tracker"),
+                                   error->message);
+                       g_error_free (error);
+                       return EXIT_FAILURE;
+               }
+
+               *files = tracker_sparql_cursor_get_integer (cursor, 0);
+
+               g_object_unref (cursor);
+       }
+
+       if (folders) {
+               const gchar query[] =
+                       "\nSELECT COUNT(?folders)"
+                       "\nWHERE { "
+                       "\n  ?folders a nfo:Folder ;"
+                       "\n           tracker:available true ."
+                       "\n}";
+
+               cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+
+               if (error || !tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+                       g_printerr ("%s, %s\n",
+                                   _("Could not get basic status for Tracker"),
+                                   error->message);
+                       g_error_free (error);
+                       return EXIT_FAILURE;
+               }
+
+               *folders = tracker_sparql_cursor_get_integer (cursor, 0);
+
+               g_object_unref (cursor);
+       }
+
+       g_object_unref (connection);
+
+       return EXIT_SUCCESS;
+}
+
+static gboolean
+are_miners_finished (gint *max_remaining_time)
+{
+       TrackerMinerManager *manager;
+       GError *error = NULL;
+       GSList *miners_running;
+       GSList *l;
+       gboolean finished = TRUE;
+       gint _max_remaining_time = 0;
+
+       /* Don't auto-start the miners here */
+       manager = tracker_miner_manager_new_full (FALSE, &error);
+       if (!manager) {
+               g_printerr (_("Could not get status, manager could not be created, %s"),
+                           error ? error->message : _("No error given"));
+               g_printerr ("\n");
+               g_clear_error (&error);
+               return EXIT_FAILURE;
+       }
+
+       miners_running = tracker_miner_manager_get_running (manager);
+
+       for (l = miners_running; l; l = l->next) {
+               gchar *status;
+               gdouble progress;
+               gint remaining_time;
+
+               if (!tracker_miner_manager_get_status (manager,
+                                                      l->data,
+                                                      &status,
+                                                      &progress,
+                                                      &remaining_time)) {
+                       continue;
+               }
+
+               g_free (status);
+
+               finished &= progress == 1.0;
+               _max_remaining_time = MAX(remaining_time, _max_remaining_time);
+       }
+
+       g_slist_foreach (miners_running, (GFunc) g_free, NULL);
+       g_slist_free (miners_running);
+
+       if (max_remaining_time) {
+               *max_remaining_time = _max_remaining_time;
+       }
+
+       g_object_unref (manager);
+
+       return finished;
+}
+
+static int
+get_no_args (void)
+{
+       gchar *str;
+       gchar *data_dir;
+       guint64 remaining_bytes;
+       gdouble remaining;
+       gint remaining_time;
+       gint files, folders;
+
+       /* How many files / folders do we have? */
+       if (get_file_and_folder_count (&files, &folders) != 0) {
+               return EXIT_FAILURE;
+       }
+
+       g_print (_("Currently indexed"));
+       g_print (": ");
+       g_print (g_dngettext (NULL,
+                             "%d file",
+                             "%d files",
+                             files),
+                files);
+       g_print (", ");
+       g_print (g_dngettext (NULL,
+                             "%d folders",
+                             "%d folders",
+                             folders),
+                folders);
+       g_print ("\n");
+
+       /* How much space is left? */
+       data_dir = g_build_filename (g_get_user_cache_dir (), "tracker", NULL);
+
+       remaining_bytes = tracker_file_system_get_remaining_space (data_dir);
+       str = g_format_size (remaining_bytes);
+
+       remaining = tracker_file_system_get_remaining_space_percentage (data_dir);
+       g_print ("%s: %s (%3.2lf%%)\n",
+                _("Remaining space on database partition"),
+                str,
+                remaining);
+       g_free (str);
+       g_free (data_dir);
+
+       /* Are we finished indexing? */
+       if (!are_miners_finished (&remaining_time)) {
+               gchar *remaining_time_str;
+
+               remaining_time_str = tracker_seconds_to_string (remaining_time, TRUE);
+
+               g_print ("%s: ", _("Data is still being indexed"));
+               g_print (_("Estimated %s left"), remaining_time_str);
+               g_print ("\n");
+               g_free (remaining_time_str);
+       } else {
+               g_print ("%s\n", _("All data miners are idle, indexing complete"));
+       }
+
+       g_print ("\n\n");
+
+       return EXIT_SUCCESS;
+}
+
+static int
+status_run_default (void)
+{
+       return get_no_args ();
+}
+
+static gboolean
+status_options_enabled (void)
+{
+       return STATUS_OPTIONS_ENABLED ();
+}
+
+int
+tracker_status (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker status";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (status_options_enabled ()) {
+               return status_run ();
+       }
+
+       return status_run_default ();
+}
diff --git a/src/tracker/tracker-status.h b/src/tracker/tracker-status.h
new file mode 100644
index 0000000..f348baf
--- /dev/null
+++ b/src/tracker/tracker-status.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_STATUS_H__
+#define __TRACKER_STATUS_H__
+
+int tracker_status (int argc, const char **argv);
+
+#endif /* __TRACKER_STATUS_H__ */
diff --git a/src/tracker/tracker-tag.c b/src/tracker/tracker-tag.c
index f836b97..1c275bb 100644
--- a/src/tracker/tracker-tag.c
+++ b/src/tracker/tracker-tag.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009, Nokia <ivan frade nokia com>
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -29,15 +30,13 @@
 
 #include <libtracker-sparql/tracker-sparql.h>
 
-#define ABOUT \
-       "Tracker " PACKAGE_VERSION "\n"
+#include "tracker-tag.h"
 
-#define LICENSE \
-       "This program is free software and comes without any warranty.\n" \
-       "It is licensed under version 2 or later of the General Public " \
-       "License which can be viewed at:\n" \
-       "\n" \
-       "  http://www.gnu.org/licenses/gpl.txt\n";
+#define TAG_OPTIONS_ENABLED() \
+       (resources || \
+        add_tag || \
+        remove_tag || \
+        list)
 
 static gint limit = 512;
 static gint offset;
@@ -48,21 +47,8 @@ static gchar *remove_tag;
 static gchar *description;
 static gboolean *list;
 static gboolean show_resources;
-static gboolean print_version;
 
 static GOptionEntry entries[] = {
-       { "limit", 'l', 0, G_OPTION_ARG_INT, &limit,
-         N_("Limit the number of results shown"),
-         "512"
-       },
-       { "offset", 'o', 0, G_OPTION_ARG_INT, &offset,
-         N_("Offset the results"),
-         "0"
-       },
-       { "and-operator", 'n', 0, G_OPTION_ARG_NONE, &and_operator,
-         N_("Use AND for search terms instead of OR (the default)"),
-         NULL
-       },
        { "list", 't', 0, G_OPTION_ARG_NONE, &list,
          N_("List all tags (using FILTER if specified; FILTER always uses logical OR)"),
          N_("FILTER"),
@@ -83,8 +69,16 @@ static GOptionEntry entries[] = {
          N_("Description for a tag (this is only used with --add)"),
          N_("STRING")
        },
-       { "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
-         N_("Print version"),
+       { "limit", 'l', 0, G_OPTION_ARG_INT, &limit,
+         N_("Limit the number of results shown"),
+         "512"
+       },
+       { "offset", 'o', 0, G_OPTION_ARG_INT, &offset,
+         N_("Offset the results"),
+         "0"
+       },
+       { "and-operator", 'n', 0, G_OPTION_ARG_NONE, &and_operator,
+         N_("Use AND for search terms instead of OR (the default)"),
          NULL
        },
        { G_OPTION_REMAINING, 0, 0,
@@ -969,64 +963,11 @@ get_tags_by_file (TrackerSparqlConnection *connection,
        return TRUE;
 }
 
-int
-main (int argc, char **argv)
+static int
+tag_run (void)
 {
        TrackerSparqlConnection *connection;
-       GOptionContext *context;
        GError *error = NULL;
-       const gchar *failed = NULL;
-
-       setlocale (LC_ALL, "");
-
-       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-       textdomain (GETTEXT_PACKAGE);
-
-       /* Translators: this messagge will apper immediately after the
-        * usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>
-        */
-       context = g_option_context_new (_("Add, remove or list tags"));
-
-       /* Translators: this message will appear after the usage string
-        * and before the list of options, showing an usage example.
-        */
-       g_option_context_add_main_entries (context, entries, NULL);
-       g_option_context_parse (context, &argc, &argv, NULL);
-
-       if (print_version) {
-               g_print ("\n" ABOUT "\n" LICENSE "\n");
-               g_option_context_free (context);
-
-               return EXIT_SUCCESS;
-       }
-
-       if (!list && show_resources) {
-               failed = _("The --list option is required for --show-files");
-       } else if (and_operator && (!list || !resources)) {
-               failed = _("The --and-operator option can only be used with --list and tag label arguments");
-       } else if (add_tag && remove_tag) {
-               failed = _("Add and delete actions can not be used together");
-       } else if (!list && !add_tag && !remove_tag && !resources) {
-               failed = _("No arguments were provided");
-       } else if (description && !add_tag) {
-               failed = _("The --description option can only be used with --add");
-       }
-
-       if (failed) {
-               gchar *help;
-
-               g_printerr ("%s\n\n", failed);
-
-               help = g_option_context_get_help (context, TRUE, NULL);
-               g_option_context_free (context);
-               g_printerr ("%s", help);
-               g_free (help);
-
-               return EXIT_FAILURE;
-       }
-
-       g_option_context_free (context);
 
        connection = tracker_sparql_connection_get (NULL, &error);
 
@@ -1099,3 +1040,70 @@ main (int argc, char **argv)
         */
        return EXIT_FAILURE;
 }
+
+static int
+tag_run_default (void)
+{
+       GOptionContext *context;
+       gchar *help;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+       help = g_option_context_get_help (context, TRUE, NULL);
+       g_option_context_free (context);
+       g_printerr ("%s\n", help);
+       g_free (help);
+
+       return EXIT_FAILURE;
+}
+
+static gboolean
+tag_options_enabled (void)
+{
+       return TAG_OPTIONS_ENABLED ();
+}
+
+int
+tracker_tag (int argc, const char **argv)
+{
+       GOptionContext *context;
+       GError *error = NULL;
+       const gchar *failed;
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, NULL);
+
+       argv[0] = "tracker tag";
+
+       if (!g_option_context_parse (context, &argc, (char***) &argv, &error)) {
+               g_printerr ("%s, %s\n", _("Unrecognized options"), error->message);
+               g_error_free (error);
+               g_option_context_free (context);
+               return EXIT_FAILURE;
+       }
+
+       g_option_context_free (context);
+
+       if (!list && show_resources) {
+               failed = _("The --list option is required for --show-files");
+       } else if (and_operator && (!list || !resources)) {
+               failed = _("The --and-operator option can only be used with --list and tag label arguments");
+       } else if (add_tag && remove_tag) {
+               failed = _("Add and delete actions can not be used together");
+       } else if (description && !add_tag) {
+               failed = _("The --description option can only be used with --add");
+       } else {
+               failed = NULL;
+       }
+
+       if (failed) {
+               g_printerr ("%s\n\n", failed);
+               return EXIT_FAILURE;
+       }
+
+       if (tag_options_enabled ()) {
+               return tag_run ();
+       }
+
+       return tag_run_default ();
+}
diff --git a/src/tracker/tracker-tag.h b/src/tracker/tracker-tag.h
new file mode 100644
index 0000000..cab67fe
--- /dev/null
+++ b/src/tracker/tracker-tag.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014, Lanedo <martyn lanedo com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_TAG_H__
+#define __TRACKER_TAG_H__
+
+int tracker_tag (int argc, const char **argv);
+
+#endif /* __TRACKER_TAG_H__ */
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 494deba..1eeb771 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -567,7 +567,7 @@ class MinerFsHelper (Helper):
                 log ("Kill %s manually" % self.PROCESS_NAME)
                 self.loop.run ()
         else:
-            control_binary = os.path.join (cfg.BINDIR, "tracker-control")
+            control_binary = os.path.join (cfg.BINDIR, "tracker")
 
             kws = {}
 
@@ -575,7 +575,7 @@ class MinerFsHelper (Helper):
                 FNULL = open ('/dev/null', 'w')
                 kws = { 'stdout': FNULL }
 
-            subprocess.call ([control_binary, "--kill=miners"], **kws)
+            subprocess.call ([control_binary, "daemon --kill=miners"], **kws)
 
         return False
 
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 16540c7..9db5c89 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -212,9 +212,9 @@ class TrackerSystemAbstraction:
     # Private API
     #
     def __stop_tracker_processes (self):
-        control_binary = os.path.join (cfg.BINDIR, "tracker-control")
+        control_binary = os.path.join (cfg.BINDIR, "tracker")
         FNULL = open('/dev/null', 'w')
-        subprocess.call ([control_binary, "-t"], stdout=FNULL)
+        subprocess.call ([control_binary, "daemon -t"], stdout=FNULL)
         time.sleep (1)
 
     def __recreate_directory (self, directory):
diff --git a/tests/functional-tests/create-tests-xml.py b/tests/functional-tests/create-tests-xml.py
index ddc5da6..5bbca2a 100755
--- a/tests/functional-tests/create-tests-xml.py
+++ b/tests/functional-tests/create-tests-xml.py
@@ -52,7 +52,7 @@ if (cfg.haveUpstart):
         """
 else:
         PRE_STEPS = """        <pre_steps>
-           <step>while tracker-control -p |grep -q '^Found process ID '; do tracker-control -t; sleep 1; 
done</step>
+           <step>while tracker daemon -p |grep -q '^Found process ID '; do tracker daemon -t; sleep 1; 
done</step>
         </pre_steps>
         """
 
diff --git a/tests/functional-tests/fts-tc.py b/tests/functional-tests/fts-tc.py
index 620802b..4e36e7a 100644
--- a/tests/functional-tests/fts-tc.py
+++ b/tests/functional-tests/fts-tc.py
@@ -169,7 +169,7 @@ class basic (TestUpdate) :
 
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + word + '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' + word + '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='1','search for the word is not giving results')
        os.remove(file_path)
@@ -188,7 +188,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,word)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + search_word+ '|grep  '+file_path+ '|wc -l ' )
+       result=commands.getoutput ('tracker search  ' + search_word+ '|grep  '+file_path+ '|wc -l ' )
        print result
        self.assert_(result=='1','search for the word is not giving results')
 
@@ -208,7 +208,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,word)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + search_word + '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' + search_word + '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='0','search for the non existing  word is giving results')
 
@@ -228,7 +228,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,sentence)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + search_word + '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' + search_word + '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='1','search for the word  not giving results')
 
@@ -247,7 +247,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,sentence)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -268,7 +268,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,sentence)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + search_sentence+ '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' + search_sentence+ '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -277,7 +277,7 @@ class basic (TestUpdate) :
 
       def test_text_07 (self) :
 
-       """ To check if tracker search for  sentenece gives results """ 
+       """ To check if tracker search for  sentenece gives results """
         file_path =  configuration.MYDOCS + TEST_TEXT
                     
         """copy the test files """          
@@ -287,7 +287,7 @@ class basic (TestUpdate) :
        self.edit_text(file_path,sentence)
        self.loop.run()
 
-       result=commands.getoutput ('tracker-search  ' + sentence+ '|grep  '+file_path+ '|wc -l ')
+       result=commands.getoutput ('tracker search  ' + sentence+ '|grep  '+file_path+ '|wc -l ')
        print result
        self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -296,7 +296,7 @@ class basic (TestUpdate) :
 
       def test_text_08 (self) :
 
-       """ To check if tracker search for  sentenece gives results """ 
+       """ To check if tracker search for  sentenece gives results """
 
        file_path =  configuration.MYDOCS + TEST_TEXT                   
                                                                         
@@ -308,7 +308,7 @@ class basic (TestUpdate) :
         self.edit_text(file_path,sentence)                              
         self.loop.run()                                                 
 
-        result=commands.getoutput ('tracker-search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')    
+        result=commands.getoutput ('tracker search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                    
        self.assert_(result=='0','search for the word is not giving results')
 
@@ -327,7 +327,7 @@ class basic (TestUpdate) :
         self.edit_text(file_path,word)                              
         self.loop.run()                                                 
 
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')    
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                    
        self.assert_(result=='1','search for the word is not giving results')
 
@@ -346,7 +346,7 @@ class basic (TestUpdate) :
         self.edit_text(file_path,search_word)                              
         self.loop.run()                                                 
 
-        result=commands.getoutput ('tracker-search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')    
+        result=commands.getoutput ('tracker search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                    
        self.assert_(result=='0','search for the word is not giving results')
 
@@ -354,7 +354,7 @@ class basic (TestUpdate) :
 
       def test_text_12 (self) :
 
-       """ To check if tracker-search for a word(file which contains this file is removed) gives result"""
+       """ To check if tracker search for a word(file which contains this file is removed) gives result"""
 
        file_path =  configuration.MYDOCS + TEST_TEXT                   
                                                                         
@@ -364,22 +364,22 @@ class basic (TestUpdate) :
         self.edit_text(file_path,word)                              
         self.loop.run()                                                 
 
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')    
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                    
        self.assert_(result=='1','search for the word is not giving results')
 
         self.wait_for_fileop('rm' , file_path)
 
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')    
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
        
-        result1=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path)    
+        result1=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path)
        print result1
         print result                                                    
        self.assert_(result=='0','search for the non existing files giving results')
 
       def test_text_13 (self) :                                                                              
                
                                                                                                              
                
-        """ To check if tracker-search for a word in different text files with similar 3 letter words and 
search for the word gives result """
+        """ To check if tracker search for a word in different text files with similar 3 letter words and 
search for the word gives result """
                                                                                                              
                
         file_path =  configuration.MYDOCS + TEST_TEXT                                                        
                
         file_path_02 =  configuration.MYDOCS + TEST_TEXT_02                                                  
                
@@ -401,7 +401,7 @@ class basic (TestUpdate) :
         self.loop.run()                                                                                      
                
                                                                                                              
                
         search_word = 'feet'                                                                                 
                
-        result=commands.getoutput ('tracker-search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')         
                
+        result=commands.getoutput ('tracker search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='1','search for the word is not giving results')                                
                
                                                                                                              
                
@@ -411,7 +411,7 @@ class basic (TestUpdate) :
 
       def test_text_14 (self) :                                                                              
                
                                                                                                              
                
-        """ To check if tracker-search for a word in unwatched directory and gives result"""                 
                
+        """ To check if tracker search for a word in unwatched directory and gives result"""
                                                                                                              
                
         file_path =  "/root/" + TEST_TEXT                                                                    
                
                                                                                                              
                
@@ -419,7 +419,7 @@ class basic (TestUpdate) :
         self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT, file_path)                                      
                
         word = "framework"                                                                                   
                
                                                                                                              
                
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')                
                
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='0','search for the word is not giving results')                                
                
                                                                                                              
                
@@ -427,7 +427,7 @@ class basic (TestUpdate) :
                                                                                                              
                
       def test_text_15 (self) :                                                                              
                
                                                                                                              
                
-        """ To check if tracker-search for a word(file which is copied from no watch directories to watched 
directories) gives results """
+        """ To check if tracker search for a word(file which is copied from no watch directories to watched 
directories) gives results """
                                                                                                              
                
         FILE_NAME =  "/root/" + TEST_TEXT                                                                    
                
         file_path =  configuration.MYDOCS + TEST_TEXT                                                        
                
@@ -441,7 +441,7 @@ class basic (TestUpdate) :
                                                                                                              
                
         word = "framework"                                                                                   
                
                                                                                                              
                
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')                
                
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='1','search for the word is giving results')                                    
                
                                                                                                              
                
@@ -449,14 +449,14 @@ class basic (TestUpdate) :
 
       def test_text_16 (self) :                                                                              
                
                                                                                                              
                
-        """ To check if tracker-search for a word(file which is in hidden directory) gives result"""         
                
+        """ To check if tracker search for a word(file which is in hidden directory) gives result"""
         file_path =  HIDDEN_DIR+TEST_TEXT                                                                    
               
                                                                                                              
                
         """copy the test files """                                                                           
                
         self.wait_for_fileop('cp', SRC_TEXT_DIR + TEST_TEXT , file_path)                                     
                
         word = "framework"                                                                                   
                
                                                                                                              
                
-        result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')                
                
+        result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='0','search for the word is giving results')                                    
                
                                                                                                              
                
@@ -494,12 +494,12 @@ class db_text ( TestUpdate ) :
         word = "summer"                                     
         self.edit_text(file_path,word)
        time.sleep(2)
-       result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')                 
        
+       result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='1','search for the word is not giving results')   
        commands.getoutput('cp  '+SRC_IMAGE_DIR+TEST_IMAGE+ '  '+TEXT_DB)
        time.sleep(1)
-       result=commands.getoutput ('tracker-search  ' + word+ '|grep  '+file_path+ '|wc -l ')                 
        
+       result=commands.getoutput ('tracker search  ' + word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='1','search for the word is not giving results')   
 
@@ -523,7 +523,7 @@ class msm (TestUpdate) :
        commands.getoutput ('mount -t vfat -o rw ' +MOUNT_PARTITION+'  '+MYDOCS)
        time.sleep(10)
         search_word = "information"                                     
-       result=commands.getoutput ('tracker-search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')          
               
+       result=commands.getoutput ('tracker search  ' + search_word+ '|grep  '+file_path+ '|wc -l ')
         print result                                                                                         
                
         self.assert_(result=='1','search for the word is not giving results')   
 
@@ -541,7 +541,7 @@ class specialchar (TestUpdate) :
         self.edit_text(file_path,sentence)
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -560,7 +560,7 @@ class specialchar (TestUpdate) :
 
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -579,7 +579,7 @@ class specialchar (TestUpdate) :
         self.edit_text(file_path,sentence)
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -598,7 +598,7 @@ class specialchar (TestUpdate) :
         self.edit_text(file_path,sentence)
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -617,7 +617,7 @@ class specialchar (TestUpdate) :
         self.edit_text(file_path,sentence)
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +sentence+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -637,7 +637,7 @@ class specialchar (TestUpdate) :
         self.edit_text(file_path,sentence)
         self.loop.run()
 
-        result=commands.getoutput ('tracker-search  ' +word+ '|grep  '+file_path+ '|wc -l ')
+        result=commands.getoutput ('tracker search  ' +word+ '|grep  '+file_path+ '|wc -l ')
         print result
         self.assert_(result=='1','search for the sentence is not giving results')
 
@@ -647,35 +647,35 @@ class applications (TestUpdate) :
 
        def test_app_Images (self) :
 
-           result= commands.getoutput ('tracker-search -i ' + TEST_IMAGE+ '|wc -l')
+           result= commands.getoutput ('tracker search -i ' + TEST_IMAGE+ '|wc -l')
            self.assert_(result!=0 , 'tracker search for images is not giving results')
 
 
        def test_app_Music (self) :
 
-           result= commands.getoutput ('tracker-search -m ' + TEST_MUSIC+ '|wc -l')
+           result= commands.getoutput ('tracker search -m ' + TEST_MUSIC+ '|wc -l')
            self.assert_(result!=0 , 'tracker search for music is not giving results')
 
        def test_app_Vidoes (self) :
 
-           result= commands.getoutput ('tracker-search -v ' + TEST_VIDEO+ '|wc -l')
+           result= commands.getoutput ('tracker search -v ' + TEST_VIDEO+ '|wc -l')
            self.assert_(result!=0 , 'tracker search for Videos is not giving results')
 
 
        def test_app_music_albums (self) :
 
-           result= commands.getoutput ('tracker-search --music-albums SinCos  | wc -l')
+           result= commands.getoutput ('tracker search --music-albums SinCos  | wc -l')
            self.assert_(result!=0 , 'tracker search for music albums is not giving results')
 
        
        def test_app_music_artists (self) :
 
-           result= commands.getoutput ('tracker-search --music-artists AbBaby  | wc -l')
+           result= commands.getoutput ('tracker search --music-artists AbBaby  | wc -l')
            self.assert_(result!=0 , 'tracker search for music artists is not giving results')
 
        def test_app_folders (self) :
 
-           result= commands.getoutput ('tracker-search -s '+TEST_DIR_1 + '| wc -l')
+           result= commands.getoutput ('tracker search -s '+TEST_DIR_1 + '| wc -l')
            self.assert_(result!=0 , 'tracker search for folders is not giving results')
 
        
@@ -687,7 +687,7 @@ class applications (TestUpdate) :
                       """
            self.resources_new.SparqlUpdate (INSERT)
            
-           result = commands.getoutput ('tracker-search -ea searching_for_Email |wc -l ')
+           result = commands.getoutput ('tracker search -ea searching_for_Email |wc -l ')
            self.assert_(result!=0 , 'tracker search for files is not giving results')
 
        def test_app_email (self) :
@@ -699,7 +699,7 @@ class applications (TestUpdate) :
            #self.resources.SparqlUpdate (INSERT)
             self.resources.SparqlUpdate  (INSERT)
            
-           result = commands.getoutput ('tracker-search -ea searching_for_Email |wc -l ')
+           result = commands.getoutput ('tracker search -ea searching_for_Email |wc -l ')
            self.assert_(result!=0 , 'tracker search for files is not giving results')
 
 
diff --git a/tests/functional-tests/ipc/test-busy-handling.vala 
b/tests/functional-tests/ipc/test-busy-handling.vala
index bad4170..874bde4 100644
--- a/tests/functional-tests/ipc/test-busy-handling.vala
+++ b/tests/functional-tests/ipc/test-busy-handling.vala
@@ -20,7 +20,7 @@
 // To run this test:
 // -===-------------
 //
-// tracker-control -k
+// tracker daemon -k
 // rm ~/.cache/tracker/meta.db
 // export TRACKER_DEBUG_MAKE_JOURNAL_READER_GO_VERY_SLOW=yes
 // tracker-store
diff --git a/tests/functional-tests/mass-storage-mode.py b/tests/functional-tests/mass-storage-mode.py
index 0844b21..9e8316c 100644
--- a/tests/functional-tests/mass-storage-mode.py
+++ b/tests/functional-tests/mass-storage-mode.py
@@ -159,7 +159,7 @@ class copy (TestUpdate):
         self.loop.run ()
 
         """ verify if miner indexed these file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied image file is not shown as indexed')
 
@@ -188,7 +188,7 @@ class copy (TestUpdate):
         self.loop.run ()
 
         """ verify if miner indexed these file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied music file is not shown as indexed')
 
@@ -219,7 +219,7 @@ class copy (TestUpdate):
         self.loop.run ()
 
         """ verify if miner indexed these file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
        print result
         self.assert_(result == '1' , 'copied video file is not shown as indexed')
 
@@ -242,7 +242,7 @@ class move (TestUpdate):
         """copy the test files """                                              
         self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path_src)      
                                                                                 
-        result =  commands.getoutput(' tracker-search -i -l 10000 | grep  ' + file_path_src + ' |wc -l' )    
  
+        result =  commands.getoutput(' tracker search -i -l 10000 | grep  ' + file_path_src + ' |wc -l' )
         self.assert_(result == '1' , 'copied image file is not shown as indexed')                            
         
                                                                                                          
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )                       
@@ -259,10 +259,10 @@ class move (TestUpdate):
         self.loop.run()                                                                                  
                                                                                                          
         """ verify if miner indexed these file.  """                                                     
-        result =  commands.getoutput(' tracker-search -i -l 10000 | grep  ' + file_path_dst + ' |wc -l' )
+        result =  commands.getoutput(' tracker search -i -l 10000 | grep  ' + file_path_dst + ' |wc -l' )
                                                                                                          
         self.assert_(result == '1'  , 'moved file is not listed in tracker search')                      
-        result1 = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path_src + ' | wc 
-l')
+        result1 = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' and result1 == '0' , 'Both the  original and moved files are listed in 
tracker search')
                                                                                                              
             
         os.remove(file_path_dst)                                                                             
             
@@ -281,7 +281,7 @@ class move (TestUpdate):
         """copy the test files """                                                                           
             
         self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path_src)                                
             
                                                                                                              
             
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')            
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' , 'copied music file is not shown as indexed')                            
             
                                                                                                              
             
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )                                                   
             
@@ -299,12 +299,12 @@ class move (TestUpdate):
                                                                                                              
             
         """ verify if miner indexed these file.  """                                                         
             
                                                                                                              
             
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_dst + ' | wc 
-l')            
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_dst + ' | wc 
-l')
         print result                                                                                         
             
         self.assert_(result == '1' , 'moved music file is not shown as indexed')                             
             
                                                                                                              
             
-        result1 = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')           
-        self.assert_(result == '1' and result1 == '0' , 'Both original and moved files are listed in tracker 
search ')    
+        result1 = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
+        self.assert_(result == '1' and result1 == '0' , 'Both original and moved files are listed in tracker 
search ')
                                                                                                              
             
         os.remove(file_path_dst)                                                                             
         
                                                                                                              
             
@@ -320,7 +320,7 @@ class move (TestUpdate):
        """copy the test files """                                                                            
            
         self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path_src)                                
             
                                                                                                              
             
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')            
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' , 'copied video file is not shown as indexed')                            
             
                                                                                                              
             
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )                                                   
             
@@ -336,11 +336,11 @@ class move (TestUpdate):
         self.loop.run()                                                                                      
             
         """ verify if miner indexed these file.  """                                                         
             
                                                                                                              
             
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_dst + ' | wc 
-l')            
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_dst + ' | wc 
-l')
                                                                                                              
         
-        self.assert_(result == '1' , 'moved file is not listed in tracker search ')                          
             
+        self.assert_(result == '1' , 'moved file is not listed in tracker search ')
                                                                                                              
             
-        result1 = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')           
+        result1 = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' and result1 == '0' , 'Both original and moved files are listed in tracker 
search ')    
                                                                                                              
         
         os.remove(file_path_dst)                                                                             
             
@@ -361,7 +361,7 @@ class rename (TestUpdate):
        """copy the test files """
        self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path_src)
 
-       result =  commands.getoutput(' tracker-search -i -l 10000 | grep  ' + file_path_src + ' |wc -l' )
+       result =  commands.getoutput(' tracker search -i -l 10000 | grep  ' + file_path_src + ' |wc -l' )
         self.assert_(result == '1' , 'copied image file is not shown as indexed')
 
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )
@@ -378,10 +378,10 @@ class rename (TestUpdate):
        self.loop.run()
 
        """ verify if miner indexed these file.  """
-       result =  commands.getoutput(' tracker-search -i -l 10000 | grep  ' + file_path_dst + ' |wc -l' )
+       result =  commands.getoutput(' tracker search -i -l 10000 | grep  ' + file_path_dst + ' |wc -l' )
 
         self.assert_(result == '1'  , 'renamed file s not listed in tracker search')
-       result1 = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path_src + ' | wc 
-l')
+       result1 = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' and result1 == '0' , 'Both the  original and renamed files are listed in 
tracker search')
 
        os.remove(file_path_dst)
@@ -399,7 +399,7 @@ class rename (TestUpdate):
        """copy the test files """
        self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path_src)
 
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' , 'copied music file is not shown as indexed')
 
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )
@@ -417,11 +417,11 @@ class rename (TestUpdate):
 
        """ verify if miner indexed these file.  """
 
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_dst + ' | wc 
-l')
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_dst + ' | wc 
-l')
         print result
         self.assert_(result == '1' , 'renamed music file is not shown as indexed')
 
-        result1 = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
+        result1 = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' and result1 == '0' , 'Both original and renamed files are listed in 
tracker search ')
 
        os.remove(file_path_dst)
@@ -439,7 +439,7 @@ class rename (TestUpdate):
        """copy the test files """
        self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path_src)
 
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' , 'copied video file is not shown as indexed')
 
         commands.getoutput ( 'umount ' + MOUNT_PARTITION )
@@ -455,11 +455,11 @@ class rename (TestUpdate):
        self.loop.run()
        """ verify if miner indexed these file.  """
 
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_dst + ' | wc 
-l')
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_dst + ' | wc 
-l')
 
         self.assert_(result == '1' , 'renamed file is not listed in tracker search ')
 
-        result1 = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
+        result1 = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path_src + ' | wc 
-l')
         self.assert_(result == '1' and result1 == '0' , 'Both original and renamed files are listed in 
tracker search ')
 
        os.remove(file_path_dst)
@@ -498,7 +498,7 @@ class subfolder (TestUpdate):
         self.loop.run ()
 
         """ verify if miner indexed these file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied image file is not shown as indexed')
 
@@ -520,7 +520,7 @@ class subfolder (TestUpdate):
         self.loop.run ()
 
         """ 2. verify if miner indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied file is not shown as indexed')
 
@@ -543,7 +543,7 @@ class subfolder (TestUpdate):
         self.loop.run ()
 
         """ verify if miner un-indexed these file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '0' , 'deleted image file is shown as indexed')
 
@@ -561,7 +561,7 @@ class delete (TestUpdate):
         self.wait_for_fileop('cp', SRC_IMAGE_DIR + TEST_IMAGE, file_path)
 
         """ 2. verify if miner indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied file is not shown as indexed')
 
@@ -585,7 +585,7 @@ class delete (TestUpdate):
         self.loop.run ()
 
         """ verify if miner un-indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -i  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '0' , 'deleted image file is shown as indexed')
 
@@ -599,7 +599,7 @@ class delete (TestUpdate):
         self.wait_for_fileop('cp', SRC_MUSIC_DIR + TEST_MUSIC, file_path)
 
         """ 2. verify if miner indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied file is not shown as indexed')
 
@@ -623,7 +623,7 @@ class delete (TestUpdate):
         self.loop.run ()
 
         """ verify if miner un-indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -m  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '0' , 'deleted music file is shown as indexed')
 
@@ -637,7 +637,7 @@ class delete (TestUpdate):
         self.wait_for_fileop('cp', SRC_VIDEO_DIR + TEST_VIDEO, file_path)
 
         """ 2. verify if miner indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
 
        print result
         self.assert_(result == '1' , 'copied file is not shown as indexed')
@@ -663,7 +663,7 @@ class delete (TestUpdate):
         self.loop.run ()
 
         """ verify if miner un-indexed this file.  """
-        result = commands.getoutput ('tracker-search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search --limit=10000  -v  | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '0' , 'deleted video file is shown as indexed')
 
@@ -699,7 +699,7 @@ class text (TestUpdate) :
 
        """ verify if miner indexed these file.  """
 
-        result = commands.getoutput ('tracker-search  -t  massstorage | grep ' + file_path + ' | wc -l')
+        result = commands.getoutput ('tracker search  -t  massstorage | grep ' + file_path + ' | wc -l')
         print result
         self.assert_(result == '1' , 'copied text file is not shown as indexed')
 
@@ -723,12 +723,12 @@ class no_file_op(TestUpdate):
             """
            1. unmount the MyDocs
 
-            2. check if tracker-search -i is retrieving result """
+            2. check if tracker search -i is retrieving result """
 
            check_mount()
            commands.getoutput ('umount /dev/mmcblk0p1')
              
-           result = commands.getoutput ('tracker-search -f -l 10000 | grep ' + MYDOCS + '  |wc -l ')
+           result = commands.getoutput ('tracker search -f -l 10000 | grep ' + MYDOCS + '  |wc -l ')
            print result
            self.assert_(result == '0' , 'Tracker is listing the files when the device is connected in mass 
storage mode')
 
@@ -737,12 +737,12 @@ class no_file_op(TestUpdate):
 
             """1. unmount the MyDocs
 
-               2. check if tracker-search -ia is retrieving result """
+               2. check if tracker search -ia is retrieving result """
 
            check_mount()
             commands.getoutput ('umount /dev/mmcblk0p1')
              
-            result = commands.getoutput ('tracker-search -f -l 10000 |wc -l ')
+            result = commands.getoutput ('tracker search -f -l 10000 |wc -l ')
             self.assert_(result != 0 , 'Tracker(checked with -a) is not listing the files when the device is 
connected in mass storage mode')
 
 if __name__ == "__main__":
diff --git a/tests/functional-tests/performance-tc-modified.py 
b/tests/functional-tests/performance-tc-modified.py
index c776a5c..62071aa 100644
--- a/tests/functional-tests/performance-tc-modified.py
+++ b/tests/functional-tests/performance-tc-modified.py
@@ -36,7 +36,7 @@ RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
 """import .ttl files """
 """
 def stats() :
-    a1=commands.getoutput("tracker-stats |grep  %s " %(stats[i]))
+    a1=commands.getoutput("tracker status --stat |grep  %s " %(stats[i]))
     b1=a1.split()
     after=b1[2]
     return after
@@ -44,7 +44,7 @@ def stats() :
 def import_ttl (music_ttl):
        1. Checking the tracker stats before importing the ttl file .
        2. Importing the ttl file .
-       3. Check the tracker-stats after importing the ttl file.
+       3. Check the tracker status --stat after importing the ttl file.
        4. Check if the stats got changed.
     bus= dbus.SessionBus()
     imp_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Resources')
@@ -56,10 +56,10 @@ def import_ttl (music_ttl):
     stats=['nmm:Artist','nmm:MusicAlbum']
     for i in range(len(ttl)) :
          file_ttl='file://' +music_ttl+'/'+ttl[i]
-         a=commands.getoutput("tracker-stats | grep  %s " %(stats[i]) )
+         a=commands.getoutput("tracker status --stat | grep  %s " %(stats[i]))
         b=a.split()
          imp_iface.Load(file_ttl)
-        a1=commands.getoutput("tracker-stats |grep  %s " %(stats[i]))
+         a1=commands.getoutput("tracker status --stat |grep  %s " %(stats[i]))
          b1=a1.split()
          after=b1[2]
         while (t < 2):
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index cedb21e..6abe38a 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -33,7 +33,7 @@ RESOURCES_IFACE = "org.freedesktop.Tracker1.Resources"
 """import .ttl files """
 """
 def stats() :
-    a1=commands.getoutput("tracker-stats |grep  %s " %(stats[i]))
+    a1=commands.getoutput("tracker status --stat |grep  %s " %(stats[i]))
     b1=a1.split()
     after=b1[2]
     return after
@@ -41,7 +41,7 @@ def stats() :
 def import_ttl (music_ttl):
        1. Checking the tracker stats before importing the ttl file .
        2. Importing the ttl file .
-       3. Check the tracker-stats after importing the ttl file.
+       3. Check the tracker status --stat after importing the ttl file.
        4. Check if the stats got changed.
     bus= dbus.SessionBus()
     imp_obj = bus.get_object('org.freedesktop.Tracker1','/org/freedesktop/Tracker1/Resources')
@@ -53,10 +53,10 @@ def import_ttl (music_ttl):
     stats=['nmm:Artist','nmm:MusicAlbum']
     for i in range(len(ttl)) :
          file_ttl='file://' +music_ttl+'/'+ttl[i]
-         a=commands.getoutput("tracker-stats | grep  %s " %(stats[i]) )
+         a=commands.getoutput("tracker status --stat | grep  %s " %(stats[i]) )
         b=a.split()
          imp_iface.Load(file_ttl)
-        a1=commands.getoutput("tracker-stats |grep  %s " %(stats[i]))
+        a1=commands.getoutput("tracker status --stat |grep  %s " %(stats[i]))
          b1=a1.split()
          after=b1[2]
         while (t < 2):
diff --git a/utils/clean-prefix/clean-tracker-prefix b/utils/clean-prefix/clean-tracker-prefix
index 9282869..ecf492d 100755
--- a/utils/clean-prefix/clean-tracker-prefix
+++ b/utils/clean-prefix/clean-tracker-prefix
@@ -36,8 +36,8 @@ if [ -n "$1" ]; then
        prefix=$1
 fi
 
-if [ -e $prefix/bin/tracker-control ]; then
-       $prefix/bin/tracker-control -r
+if [ -e $prefix/bin/tracker ]; then
+       $prefix/bin/tracker reset --hard
 fi
 
 
diff --git a/utils/data-generators/cc/ttl/README b/utils/data-generators/cc/ttl/README
index 796217c..92e3c71 100644
--- a/utils/data-generators/cc/ttl/README
+++ b/utils/data-generators/cc/ttl/README
@@ -1,4 +1,4 @@
 The turtle files are created in this directory. For importing them into
 tracker use:
 
-tracker-import *.ttl
+tracker import *.ttl
diff --git a/utils/sandbox/tracker-sandbox.py b/utils/sandbox/tracker-sandbox.py
index 7018432..96db379 100755
--- a/utils/sandbox/tracker-sandbox.py
+++ b/utils/sandbox/tracker-sandbox.py
@@ -173,7 +173,7 @@ def db_query_files_that_match():
 
 # Index functions
 def index_clean():
-       #tracker-control -r
+       #tracker reset --hard
        debug ('Cleaning index, FIXME: Does nothing.')
 
 def find_libexec_binaries(command):
@@ -289,7 +289,7 @@ def environment_unset():
        if not opts.update:
                return
 
-       # FIXME: clean up tracker-store, can't use tracker-control for this,
+       # FIXME: clean up tracker-store, can't use 'tracker daemon ...' for this,
        #        that kills everything it finds in /proc sadly.
        if store_pid > 0:
                debug('  Killing Tracker store')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]