Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How do i find a file major and minor number

by johngg (Abbot)
on Dec 07, 2011 at 17:55 UTC ( #942299=note: print w/ replies, xml ) Need Help??


in reply to How do i find a file major and minor number

Probably something similar to this using lstat or stat.

knoppix@Microknoppix:~$ perl -E ' > $rdev = ( stat q{/dev/zero} )[ 6 ]; > $minor = $rdev % 256; > $major = int( $rdev / 256 ); > say $rdev; > say $major; > say $minor;' 261 1 5 knoppix@Microknoppix:~$ ls -l /dev/zero crw-rw-rw- 1 root root 1, 5 Dec 7 11:39 /dev/zero knoppix@Microknoppix:~$ perl -E ' > $rdev = ( stat q{/dev/zram0} )[ 6 ]; > $minor = $rdev % 256; > $major = int( $rdev / 256 ); > say $rdev; > say $major; > say $minor;' 64512 252 0 knoppix@Microknoppix:~$ ls -l /dev/zram0 brw-rw---- 1 root disk 252, 0 Dec 7 11:39 /dev/zram0 knoppix@Microknoppix:~$

I hope this is helpful.

Cheers,

JohnGG


Server Error (Error ID 8294642a86847)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942299]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2015-03-29 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (632 votes), past polls