Click to See Complete Forum and Search --> : What is /dev/random?
RedMap
01-19-2004, 06:48 PM
I thought /dev/random had a random number in it everytime you looked at it.
So I did;
cat /dev/random
and it created junk, OK, but when I ctrl-C from it, I left me with a garbaged terminal with everycharacter swaped about.
What is going on? - how and why does it do this?
Also, what exactly does;
dd if=/dev/random of=somefile
do? I'd guess it would create a file with a random number in it, or not? - But how long would it know how to make the file?
mdwatts
01-19-2004, 06:55 PM
G4L search results for 'What is /dev/random?' (http://www.google.com/linux?hl=en&lr=&ie=ISO-8859-1&q=What+is+%2Fdev%2Frandom%3F&btnG=Google+Search). You will find the answer.
RedMap
01-19-2004, 07:10 PM
so when I exit from a 'cat /dev/random', why is my terminal characters swapped around?
Yeah, and that second question...?
stiles
01-19-2004, 07:50 PM
prob the control characters blew up your term.
It doesn't, I would use the head command to grab x bytes n pipe it through uuencode to clean up the control characters and then you still may need to filter it more.
GaryJones32
01-20-2004, 01:17 PM
/dev/random /dev/urandom /dev/zero
and like that generate "bytes" not data types like numbers
if you want to look use hexdump or od
example:
od -t x1 /dev/random
(type or move your mouse)
Ctrl C
to get out
RedMap
06-05-2004, 08:56 AM
OK, thanks for that.
So about the control characters screwing cat...
If I had a file, and I 'cat filename', if that file had control characters in it could really screw your system?
Is that safe?
sharth
06-06-2004, 11:04 AM
okay...
I doubt that catting a file with control characters could screw up your system. But even then, you wouldn't / shouldn't be doing things as root unless need be so It's not the end of the world.
a few devices were named...
/dev/zero is basically a file that will basically return a null character.
/dev/random will provide random bytes from an entropy pool on your system.
/dev/urandom will also take random bytes from an entropy pool on your system, but if the pool becomes empty, then the system will generate additional bytes as needed (less secure than /dev/random).
and for a helpful little command, when your terminal "blows up", hit crtl+c to clear the prompt, and then run a program named reset in that terminal.