1833847 Members
2037 Online
110063 Solutions
New Discussion

Re: Device files

 
SOLVED
Go to solution
Sanjiv Sharma_1
Honored Contributor

Device files

Can I have a command or simple script which checks that the Device files are located only in the /dev directory or in a subdirectory
under /dev?

OS = HPUX 11.11

Thanks in advance.
Everything is possible
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Device files

This will find all the block special or character special device nodes on your box:

find / \( -type b -o -type c \) -print
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Device files

Hi:

This is a brutal search, because you will search all of your filesystems:

# find / \( -type b -o -type c \) -exec ls -l {} \+

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Device files

... and in keeping with standard UNIX policy that no news is good news you can add this test:

find / \( \( -type b -o -type c \) -a ! -path '/dev/*' \) -print

This will list all block and character device files that are not in /dev.
If it ain't broke, I can fix that.
Babu A
Frequent Advisor

Re: Device files

Hi Sanjiv,

# find /dev \( -type b -o -type c \)

the above command will give you the list of device files under /dev and subdirectory under /dev.

Thanks,
Babu
Sanjiv Sharma_1
Honored Contributor

Re: Device files

No news is good news seems to be the best solution. Thanks
Everything is possible