Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7569755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:14:45+00:00 2026-05-30T15:14:45+00:00

I am searching a file system and utilising grep. I see that everything is

  • 0

I am searching a file system and utilising grep. I see that everything is working until this error appears:

Grep: /proc/sysrq-trigger: Input/output error

I have found information in various places on the net where others have come accross the same problem, but nowhere really was there anything that worked. I tried 2>/dev/null which supressed the error but didn’t ‘skip the file’ which is really what I hoped it would do. Instead it just stops the process (which is a find/sed process utilising grep). I think there is a way to specify files for exclusion using grep, but I am hoping that there may be a more robust and elegant solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:14:45+00:00Added an answer on May 30, 2026 at 3:14 pm

    It sounds as if you are recursively searching your entire filesystem hierarchy. That won’t work as expected on most systems.

    On Linux at least /proc and /sys are virtual filesystems – they do not correspond to an actual file on disk. The special files in /dev are also not actual files – they correspond to some of the devices on your system, such as hard disks, input devices e.t.c. Modifying – and, occasionally, even reading – files under any of these directories should never happen in an uncontrolled manner, since you can crash the kernel, ruin your filesystems and even cause permanent damage to your hardware.

    Since you are using find to perform the search, you need to restrict the scope of its search:

    • Use explicit negated -path options:

      find / -maxdepth 2 -type f ! -path '/proc/*' ! -path '/sys/*'
      
    • Use the -prune option:

      find / -maxdepth 2 -path '/proc' -prune -o -path '/sys' -prune -o -type f -print
      
    • Use the -xdev option to avoid descending to other filesystems completely:

      find / -maxdepth 2 -xdev -type f
      

    You can use as many -path and/or -prune options as you need to fine-tune the output of find. I recommend, though, that you inspect its output before passing it to any of the later stages in the pipeline.

    EDIT:

    Here are some examples of damage caused when accessing certain files in an uncontrolled manner – usually as root:

    • Older kernels used to crash if /proc/kcore was read as root. I believe that this no longer happens, but I have encountered this since /proc/kcore was introduced in the 2.4.x kernel series and it occasionally pops up again, so I am in no mood to actually test it…

    • Reading a block device via its device node in /dev/ can severely slow down any other operation on that device, since it bypasses the VFS and various caches. Imagine, for example, reading a 6TB RAID-5 partion directly, while other processes attempt to use it properly via the installed filesystem. Using -type f in find should prevent this from happening.

    • Since you mentioned modification, you could easily brick an embedded device by corrupting its firmware, which is accessible via /dev/mtd*. In some cases its impossible to recover from such corruption without some pretty extreme measures.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Searching here I found that this question was already asked , but I think
My .NET application needs to access specific file types without searching the entire system.
I have a web-based documentation searching/viewing system that I'm developing for a client. Part
I am searching a library or jar file for making a system monitoring program.
I'm searching for this, but I can't find it, yet I know that this
I'm searching for a multiuser web-based calendar system that supports multiple users. I'm looking
Currently, CTRL + P (Goto Anything) shortcut searching the file only in the current
hello I am making web page searching program with windows batch file before searching
I am searching for an algorithm for file encryption/decryption which satisfies the following requirements:
I am searching for the way to download concrete pieces of file (e.q. first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.