Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

subsonix

macrumors 68040
Original poster
Feb 2, 2008
3,551
79
Hi,

Does someone know if there are any explaination somewhere of the content in the /dev folder of a standard os X install, including which devices that can be used from programs or commandline?
 

larkost

macrumors 6502a
Oct 13, 2007
534
1
Those are the "raw devices", one way that drivers expose what they are driving to other layers. For the most part you don't want to touch anything in there unless you already know you need to.

Here are a few off the top of my head:

/dev/null -> also known as the bit-bucket. Anything written to here just goes away. This can be useful in scripts when you don't want the output, and want to make sure that it does not pop up somewhere else.

/dev/random -> can be used as a source of random information.

/dev/urandom -> in MacOS X this is the same as /dev/random

/dev/tty* -> the terminals use this to communicate.

/dev/disk* -> these are the disks and volumes before the filesystem drivers get to them, but a little filtered

/dev/rdisk* -> even lower-level access to the stream of bytes on the disks (only useful for cloning operations)

These are all fairly standard for *nix systems. There are usually small differences in them between OSs, but the broad strokes remain the same.
 

subsonix

macrumors 68040
Original poster
Feb 2, 2008
3,551
79
Those are the "raw devices", one way that drivers expose what they are driving to other layers. For the most part you don't want to touch anything in there unless you already know you need to.

Here are a few off the top of my head:

/dev/null -> also known as the bit-bucket. Anything written to here just goes away. This can be useful in scripts when you don't want the output, and want to make sure that it does not pop up somewhere else.

/dev/random -> can be used as a source of random information.

/dev/urandom -> in MacOS X this is the same as /dev/random

/dev/tty* -> the terminals use this to communicate.

/dev/disk* -> these are the disks and volumes before the filesystem drivers get to them, but a little filtered

/dev/rdisk* -> even lower-level access to the stream of bytes on the disks (only useful for cloning operations)

These are all fairly standard for *nix systems. There are usually small differences in them between OSs, but the broad strokes remain the same.


Thanks

I´m reading a book about unix programming at the moment and have come across this. It sees like apple have removed some of the devices from the /dev folder however and are reffering to the i/oKit framework for those devices.

I was just interestred to see what was present but it seems to be mostly related to the terminal and disks as well as some standard connected usb devices. I did try some experiments like with 'cat' to files which revealed a bit about the nature of the particular dev I looked at.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.