Difference between revisions of "Everything is a File"
Jump to navigation
Jump to search
(New page: ''"On a UNIX system, everything is a file; if something is not a file, it is a process."'' "Everything is a file" is a core design principle of Unix (and hence Linux) architecture. It ca...) |
|||
| Line 8: | Line 8: | ||
sudo cat /dev/input/mice | sudo cat /dev/input/mice | ||
in the terminal and move your mouse around. It might become clearer if you pipe the output through hexdump | in the terminal and move your mouse around. It might become clearer if you pipe the output through hexdump | ||
| − | sudo cat /dev/input/mice | + | sudo cat /dev/input/mice | hexdump |
Revision as of 10:57, 17 February 2011
"On a UNIX system, everything is a file; if something is not a file, it is a process."
"Everything is a file" is a core design principle of Unix (and hence Linux) architecture. It can be taken to mean two things
Everything is a stream of bytes
Everything is a stream of bytes you can read and/or write to. Not just documents but also storage devices like a CD-ROM in fact almost any device. This is in keeping with Unix philosophy which favors simplicity, universality and plain text. This means that you can treat devices and other parts of the system just like you would any other text file. To demonstrate this plug in an external mouse and type
sudo cat /dev/input/mice
in the terminal and move your mouse around. It might become clearer if you pipe the output through hexdump
sudo cat /dev/input/mice | hexdump