Linux Device Files - Part VI
- 0
- Add a Comment
- No Related Post
Linux Device Files - Part VI
We’re finishing up the roll-through on device files in Linux. So far, we’ve seen IDE devices, input devices, parallel port devices, and devices that send a file to nowhere. Today, we’ll look at two more files that do odd things.
/random: /dev/random is a kernel-level random number generator. This is about as close to a true random number generator as is possible. It’s called a non-deterministic generator because the value of the next number cannot be determined from the value of the previous one. While this may sound frivolous, it’s important to your system in an interesting way. Crypto keys for your system are generated using /dev/random. So, as you can see, it’s important that the numbers generated are actually random, or at least so near random as to be indiscernable from non-random numbers.
/zero: We’ve talked about /dev/zero in a previous issue of Penguin Shell. You’ll recall that there are a few ways to generate an empty file. One would be to use the touch command, as in:
touch procmail/log
This creates an empty file quickly. The other alternative is to utilize /dev/zero, with the following command:
dd if=/dev/zero of=zero_test bs=8192
Used in this way, /dev/zero creates a truly empty file named zero_text, with a block size of 8192. /dev/zero simply returns a zero every time it’s read from. It’s a close parallel to /dev/null - just in the reverse direction. Where /dev/null takes a file and makes it nothing, /dev/zero creates a nothing file.
That’s it for device files in Linux. You’ve seen alot over the past week. Remember that this list isn’t necessarily all inclusive, and doesn’t yet cover the devFS filesystem, rolling out in most Linux distributions as we speak. We’ll save that for a later series.
