Skip to content

Type filter

pls allows the user to only list specific node types in the output.


--typ/-t can be used to select the node types the user wants to see. The flag can be specified multiple times to enable multiple file types. Each time it can take one of these values.

dirregular folder
symlinksymbolic link
fifonamed pipe
socketfile-based socket
block_deviceblock special device file
char_devicecharacter special device file
fileregular file
noneshorthand: no node types
allshorthand: all node types


When parsing the --typ/-t flag, values are read from the CLI, in order, and added to a vector of node types till we encounter a shorthand value. If the shorthand value is none, the vector is cleared. If the shorthand value is all, the vector is filled with all the node types.

For example, consider the pls invocation below.

Terminal window
pls --typ=symlink --typ=all --typ=none --typ=dir
  • symlink is added to the list.
  • All the file types are added to the list, including the already existing symlink.
  • All entries so far are dropped when none is encountered.
  • dir is added to the list.

The final set contains only dir and so pls will only list the directories.


Terminal window
pls # or --typ=all or --t=all

dir/ 󰌹 block_dev@ 󱞣 /dev/disk0 󰌹 char_dev@ 󰁔 /dev/null   fifo|   file   socket= 󰌹 sym@ 󰁔 ./dir

Terminal window
pls --typ=dir --typ=symlink # or -t=dir -t=symlink

dir/ 󰌹 block_dev@ 󱞣 /dev/disk0 󰌹 char_dev@ 󰁔 /dev/null 󰌹 sym@ 󰁔 ./dir

Terminal window
pls --typ=dir --typ=symlink fifo # `--typ` has no effect

​  fifo|