1 How to use the converter
Twann edited this page 8 months ago

How to use the converter



TBlock has a built-in CLI converter, that you can use to easily convert your filters into a different syntax. If you have TBlock installed on your machine, then you also have the converter. To display the help page of the converter, simply run:

tblockc -h

Basic usage

Here is an example of how to convert a filter.

For this example, let's assume hosts.txt is a filter using hosts file format, which is going to be converted into filter.tbf using TBlock filter syntax.

tblockc hosts.txt -s tblock -o filter.tbf

By default, the converter will only convert rules. However, it is also possible to convert comments. With our example:

tblockc hosts.txt -cs tblock -o filter.tbf

Detecting syntax

TBlock can scan a filter and detect its syntax, by running:

tblockc -g /path/to/filter.txt

By default, TBlock automatically detects the syntax of a filter. Anyway, you can specify manually what is the syntax of the filter to convert:

tblockc hosts.txt -s tblock -o filter.tbf -i hosts

Be sure to specify the right syntax, otherwise the rules could be detected as invalid or converted in a wrong way.

Supported syntax

To see the current supported filter format, please see the official list.

With hosts file format

By default, when converting a filter to hosts file format, the default redirecting IP is However, if you would like the blocked domains to be redirected to instead, you can use the -0 option, like the example above:

tblockc list.txt -s0 hosts -o hosts.txt