Linux find to remove error messages, linuxfind

Source: Internet
Author: User

Linux find to remove error messages, linuxfind

In Linux, access to some directories may not be permitted, and many error messages may be printed.

1. root directory file content

-Bash-3.2 $ ls
Anaconda-ks.cfg bea Desktop lib wls1036_generic.jar.

2. Search for the file ending with. log,

-Bash-3.2 $ find.-name "*. log"
Find:./. gconfd: zookeeper.™ ä ~~~~~~~~
Find:./. gnome2: ***限 ä ~~~~~~~~
Find:./. gnome2_private: æ  ƒ 限 ä ~~~~~~~~
Find:./. Trash: ****限 ä ~~~~~~~~
Find:./. java: æ  ƒ 限 ä ~~~~~~~~
Find:./. tuscany: zookeeper 限 ä ~~~~~~~~
Find:./. eggcups: æ  ƒ 限 ä ~~~~~~~~
Find:./. chewing: zookeeper™ ä ~~~~~~~~
Find:./. mozilla/firefox: æ  ƒ 限 ä ~~~~~~~~
Find:./. scim: ****限 ä ~~~~~~~~
Find:./. metacity: specified ***限 ä ~~~~~~~~
Find:./. gconf: ****限 ä ~~~~~~~~
Find:./. nautilus/metafiles: ****限 ä ~~~~~~~~

At this time, the system language uses Chinese, but there is a problem, very strange
-Bash-3.2 $ echo $ LANG
Zh_CN.UTF-8

Temporarily changed to English

-Bash-3.2 $ export LANG = "en_US.UTF-8"
-Bash-3.2 $ echo $ LANG
En_US.UTF-8

Then search
-Bash-3.2 $ find.-name "*. log"
Find:./. gconfd: Permission denied
Find:./. gnome2: Permission denied
Find:./. gnome2_private: Permission denied
Find:./. Trash: Permission denied
Find:./. java: Permission denied
Find:./. tuscany: Permission denied
Find:./. eggcups: Permission denied
Find:./. chewing: Permission denied
Find:./. mozilla/firefox: Permission denied
Find:./. scim: Permission denied
Find:./. metacity: Permission denied
Find:./. gconf: Permission denied
Find:./. nautilus/metafiles: Permission denied

3. output the error to the/dev/null device, and the error message disappears.
-Bash-3.2 $ find.-name "*. log" 2>/dev/null
-Bash-3.2 $ find.-name "*. cfg" 2>/dev/null
/Anaconda-ks.cfg


How does linux shell remove the error message?

You can perform a redirection to shield the information, for example,>/dev/null 2> & 1

The Linux find command searches the directory to find out why there is no error with no permission.

If the user you are currently logged on to does not have the readable or executable permission for the searched directory

This error is reported.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.