Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Like every other person I am from time to time compelled to list the directory structure from a certain point int the filesystem. I do so with find /path/in/fs/ and this yields something like:


in a way this saves me from endless iterations of cd and ls.

Now I wanted to list the directory structure in the /sys/class path and I think it falls short. The next two commands show the odd behavior:

  • (1) using the cd and ls
    root@freak:/sys/class/hwmon# ls
    hwmon0  hwmon1  hwmon2
    root@freak:/sys/class/hwmon# cd hwmon0
    root@freak:/sys/class/hwmon/hwmon0# ls
    name  power  subsystem  temp1_crit  temp1_input  uevent
  • (2) using the said find command at the same place
    root@freak:/sys/class/hwmon# find .

As you can see it seems to me that find does not show me everything, which I find an odd and suprising behavior. Now I know that stuff below /sys/ is somehow special. Still it all works the cd ls way. Somebody has an answer why this happens and better even how I can make find not overlook the content in ./hwmon0 ./hwmon1 ... etc for instance?

share|improve this question
hwmon0, hwmon1, and hwmon2 are probably symlinks. The actual location of those directories is elsewhere in the /sys hierarchy. – Celada Mar 18 '13 at 6:37
yip. thank you. how could I overlook that.. thank you. – humanityANDpeace Mar 18 '13 at 6:40
since I mindelessly overlooked to check if it is symbolic links I cast my find on I have not received the result. A solution hence was to use find /sys/class/hwmon -follow -maxdepth 3 – humanityANDpeace Mar 18 '13 at 6:51
if you want find all files in the same just use find /sys/class/ -type f – Rahul Patil Mar 18 '13 at 8:07
@humanityANDpeace just update your post , what you want in output ? and what you want to achieve... – Rahul Patil Mar 18 '13 at 8:14
up vote 0 down vote accepted

When you run

find .

then it will take -P by default Option , it is actually run find -P .

Extracted From man find

   -P     Never follow symbolic links.  This  is  the  default  behaviour.
      When find examines or prints information a file, and the file is
      a symbolic link, the information used shall be  taken  from  the
      properties of the symbolic link itself.

that's why find does not show you everything under /sys/class/hwmon, if you go inside and check it's all symbolic link, So you just need to check using find . -follow

For more information check man find

share|improve this answer
yes indeed, as already laid out in the comments by Celada and myself symbolic links have been the reason. Though not personally of additional use your answer can be of value for all the people who will hence have a Question and an Answer. I will accept it surely. Thank you! – humanityANDpeace Mar 20 '13 at 6:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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