3

I found that ls command can't read file in `/proc'

Please see the attachment.

enter image description here

There are many link files ,but you can't read it by ls.

closed as unclear what you're asking by Celada, jasonwryan, Networker, Anthon, jimmij Mar 1 '15 at 12:31

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you sure process 4551 is still running? Any delay between your two screenshots gives the process time to disappear, whereupon the /proc entries for it will also disappear. – Warren Young Mar 1 '15 at 2:01
  • The files in /proc are meta-files that contain information about processes. You should try to do an ls -l to see what those symlinks are pointing to. That may give you more insight into those files. – unxnut Mar 1 '15 at 2:11
  • In your example, you didn't type "ls", just the file path. Bash reported "no such file" because it isn't an executable. – DoxyLover Mar 1 '15 at 6:26
  • @DoxyLover if that were true (it not being an executable) you would get Permission denied in sh/bash. The file is not there, hence the message (and it was probably never executable either). – Anthon Mar 1 '15 at 7:42
3

You can list files under /proc with ls, and you can read their content with cat (with a few exceptions — /proc/PID/mem is peculiar).

File under /proc reflect the current state of the system, so they might exist at one moment and no longer exist the next moment. Some of the files depend on the current process, e.g. /proc/self is a symbolic link to the PID of whichever process asked for it.

If bash reports that /proc/4551/task/4551/fd doesn't exist, it means that there is currently no process with the PID 4551. (More precisely, there is no process with this PID in the PID namespace that bash is running in.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.