I am trying to do grep on all log files which are under directory /var/log/application/archived/
And I have sudo access. Trying like below is giving me error
sudo grep 'checkThis' /var/log/application/archived/*.log
Error
grep: /var/log/application/archived/*.log: No such file or directory
I tried with escape char but doesn't seems to work
and If I give any one file name instead of * it gives me result.
Eg : sudo grep 'checkThis' /var/log/application/archived/firstLogFile.log
this gives me expected response
Use below command to do grep of all log files with sudo access
sudo sh -c "grep 'stringToSearch' /var/log/archived/*.log"