I'm using Linux Mint 18.3 and I have a school task to find all log files in one linux machine without any error messages. I need to put together a command and explain it throughly. I think I have found a way to use find but there is one access denied message regarding gvfs that I'm not sure how to handle. Can you help me assemble a simple and smart command that doesn't just blindly filter out any error messages but only leaves out those places where it's really no sense to look? My first try:
# find / -type f -name '*.log'
seems to return all log files but the result includes:
find: '/run/user/1000/gvfs': Permission denied
Then I tried to leave out one folder:
# find / -type d \( -name run \) -prune -o -type f -name '*.log' -print
but it doesn't seem smart to leave out the whole run folder so started to specify, to narrow it to one specific path maybe. Found this post, and unix.stackexchange.com/a/77592 answer, and tried to leave out this specific path:
# find / -name '*.log' -path '/run/user/1000/gvfs' -prune -o -type f -name '*.log' -print
but it doesn't seem to work as I expect, returning still the same, among seemingly all log files:
find: '/run/user/1000/gvfs': Permission denied
Now I run into understanding problem where I'm thinking wrong or is leaving out this one specific path the simplest and smartest thing to do at all.
find ... 2>/dev/null
– Gilles Quenot Feb 14 '18 at 22:40