Linux Philosophy

Linux borrows heavily from the UNIX operating system because it was written to be a free and open source version of UNIX. Files are stored in a hierarchical filesystem, with the top node of the system being root or simply "/". Whenever possible, Linux makes its components available via files or objects that look like files. Processes, devices, and network sockets are all represented by file-like objects, and can often be worked with using the same utilities used for regular files.

I need to know the details what the line "Whenever possible, Linux makes its components available via files or objects that look like files" and what is "file-like objects" with an appropriate example.

1 Answer 1


They are stated in the paragraph. Processes, devices, and network sockets (and others). These are objects managed by the kernel but appear as items in the file system and you can access them through specific paths. Their behavior also resemble regular files in many aspects. For example, you can read from and write to a device file (see below) just as you do with regular files.

Processes: Each process has its folder /proc/$PPID/, where $PPID is the process id. You can find the command line for the process in /proc/$PPID/cmdline, for example.

Devices: Devices appear as device files. For example, if your hard disk is connected to a SCSI controller, you are likely to find it at /dev/sda and the first partition as /dev/sda1. So if you read from /dev/sda you are actually reading the raw data on the disk. This can be useful when making an image.

Network sockets: bash uses /dev/tcp/$host/$port to identify TCP ports and alike for UDP. In general one can find information about sockets in /proc/net/{tcp,udp}

Others: Standard input is also a file and you can find it in /dev/stdin, similar for standard output. You can read from the file /dev/zero to get zeros and from /dev/random to get really high-quality random number (although very slowly). Pipe is frequently used in the shell and you can also create a named pipe. There are many more.

The answer above is based on Ubuntu LTS 16.04, other Linux/Unix versions may have different ways of indexing these objects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .