Look up anything in OpenFOAM tutorials:
# 1
gtfo
# 2
gtfo topoSetDict
gtfo toposetdict
# 3
gtfo topoSetDict 'ToFace;'
# 4
gtfo -f topoSetDict -q 'ToFace;'
gtfo --filename topoSetDict --query 'ToFace;'
To install, download the script and place it somewhere in PATH.
curl -O <link>
# e.g., copy in one of the following places
cp gtfo ~/.local/bin/
cp gtfo ~/bin/
sudo cp gtfo /usr/local/bin