Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Ignore permission denied message from find command in Linux

by | Mar 11, 2021

While running find command, received an error ‘ignore permission denied message from find’? We can help you.

Here at Bobcares, we have seen several such Linux-related errors as part of our Server Management Services for web hosts, Linux users, and online service providers.

Today we’ll take a look at the cause for this error and see how to fix it.

 

Find command basic syntax

For instance, the syntax is as follows:

find where-to-look criteria action
find /dir/to/search -name filetosearch
find /dir/to/search -name "*.c"
find /home/nixcraft/project/ -name "*.py" -print

In this example, find will search the /tmp directory for any files named “data*.txt” and display their pathnames:

find /path/to/dir -name "pattern" -print
find /tmp -iname "data*.txt"

OR

cd /tmp
find . -iname "data*.txt" -print

 

How we tackle ‘ignore permission denied message from find’

Now let’s take a look at how our Support Engineers tackle the error when executing the find command.

Recently, one of our customers was trying to execute the below find command in Linux/Unix and received “Permission denied” error messages.

find . -type d -name “bob”

So, we can hide or fix find command permission denied messages. Here is how we do it.

 

How to hide or fix find command permission denied messages

In the above example, we don’t have the read permission for vmware-root and orbit-Debian-gdm directories. So, we use the below syntax to avoid the problem.

## redirect error spam message to /dev/null ##
find where-to-look criteria action 2>/dev/null
find . -iname "data*.txt" -print 2>/dev/null

Here is the output without permission denied spam from find command:

./rtzip/data005.txt
./rtzip/data001.txt
./rtzip/data004.txt
./rtzip/data003.txt
./rtzip/data002.txt
./rtzip/data008.txt
./rtzip/data006.txt
./rtzip/data007.txt
./rtzip/data009.txt

Here, at the end of the find command 2>/dev/null tells the shell to redirect the error messages (FD #2) to /dev/null, so we don’t have to see them on screen. We use /dev/null to send any unwanted output from program/command. The system discards all data written on a /dev/null special file. To redirect standard error to /dev/null and store file list to output.txt, we type:

redirect error spam to /dev/null ##
find . -iname "data*.txt" -print 2>/dev/null > output.txt
cat output.txt

 

Exclude all “permission denied” messages from the “find” command on Linux

The one problem with the following command is that it would filter out all error messages created by the find command and not just the permission denied ones:

find / -name foo 2>/dev/null
find / -type d -name bar 2>/dev/null

In order to avoid that, we try the following find command along with grep command on Linux or Unix-like systems:

find / -name foo 2>&1 | grep -v "Permission denied"
find / -type d -name bar 2>&1 | grep -v "Permission denied"

Also, we can use the below syntax to skip “permission denied” errors messages when running find in Linux or Unix-based systems:

find /path/to/dir -name "search-patter" 2>&1 | grep -v "Permission denied"
find /etc -name "x*.conf" 2>&1 | grep -v "Permission denied"

To store output to a file, we run:

find /path/to/dir -name "search-patter" 2>&1 | grep -v "Permission denied" > output-file
find /etc -name "x*.conf" 2>&1 | grep -v "Permission denied" > output.txt

Then we display output.txt using the cat command:

cat output.txt

In the above example, we used the find command along with grep command to filter out permission denied error messages.

[Need any further assistance in Linux-related errors? – We’re available to help you]

 

Conclusion

In short, this error ‘ignore permission denied message from find’ occurs while running a ‘find’ command in Linux. Today, we saw how our Support Engineers resolve this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF