[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

Help with Unix Find Command for Red Hat

Is there a way to format a Unix find command that will search all filesystems for all instances of device files, sgid and suid files?  We have a requirement to baseline our systems so we have something to compare against in case new files of these types show up later.


1 Solution
Maciej SsysadminCommented:
find / -perm /4000 -o -perm /2000
This will find suid (4000) and sgid (2000) files.
If this doesn't work, you may try replacing '/' with '+', but this is deprecated way.

All device files are located in /dev/. To get full list, you may use:
find /dev/ -print
simple ls /dev/ command.

I think you can use following command to have listed all files you want:
find / \( -perm /4000 -o -perm /2000 -o -type c -o -type b \)
You may also add "-ls" option to above find command (after ending "\)") to have output similar to the one you can get with ls -l file.
netwrkedAuthor Commented:
Works great, many thanks for an easy solution!


Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now