# `tree-sitter query` The `query` command is used to run a query on a parser, and view the results. ```bash tree-sitter query [OPTIONS] [PATHS]... # Aliases: q ``` ## Options ### `-p/--grammar-path ` The path to the directory containing the grammar. ### `--lib-path` The path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library. ### `--lang-name` If `--lib-path` is used, the name of the language used to extract the library's language function ### `-t/--time` Print the time taken to execute the query on the file. ### `-q/--quiet` Suppress main output. ### `--paths ` The path to a file that contains paths to source files in which the query will be executed. ### `--byte-range ` The range of byte offsets in which the query will be executed. The format is `start_byte:end_byte`. ### `--row-range ` The range of rows in which the query will be executed. The format is `start_row:end_row`. ### `--scope ` The language scope to use for parsing and querying. This is useful when the language is ambiguous. ### `-c/--captures` Order the query results by captures instead of matches. ### `--test` Whether to run query tests or not. ### `--config-path ` The path to an alternative configuration (`config.json`) file. See [the init-config command](./init-config.md) for more information. ### `-n/--test-number ` Query the contents of a specific test. ### `-r/--rebuild` Force a rebuild of the parser before executing the query.