For TeX Live, issue from the terminal
This should answer
(the year can vary). This is the top level
texmf.cnf and values set here are not overridden by later loaded similar configuration files.
texmf.cnf file, which sits as
shell_escape_commands = \
Check the list, because new versions of TeX Live might change the list.
Now append the list above to the top level
texmf.cnf file (you need appropriate privileges to edit it) and add in the same way the programs you want to be available in the restricted shell. Carefully note the format: the trailing backslashes avoid adding spaces after commas.
But don't blame me if your system gets damaged by running dangerous programs in the restricted shell escape.
You can add one or more programs on the fly when calling
pdflatex (or other engine) from the command line by something like (Bash syntax)
shell_escape_commands=$(kpsewhich -var-value=shell_escape_commands),ls pdflatex file
Here the added program is