Not sure why I am not able to suppress the error message after using /dev/null 2>&1

$ ll /home/harry/workbook/smoel | grep xyz > /dev/null 2>&1
ls: cannot access /home/harry/workbook/smoel: No such file or directory

The error comes from ls, not grep.

ll /home/harry/workbook/smoel 2>/dev/null | grep xyz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.