Bash print stderr only, not stdout [duplicate]
Solution 1:
Just send the stdout to null:
cmd > /dev/null
This retains stderr, but suppresses stdout.
Solution 2:
You can use:
php -l "foo/bar.php" 2>&1 > /dev/null
i.e. redirect stderr to stdout and stdout to /dev/null
in order to get only stderr
on your terminal.