Linux and Command-Line Basics
Which of the following correctly describes the /proc directory on Linux?
- AIt is a write-protected place (for ordinary users) that collects the configuration files the kernel and services read at boot
- BIt is where device files are placed, which represent devices such as hard disks, USB drives and terminals so that they can be read and written like files
- CIt is a virtual file system through which the kernel shows running processes and the system state as files; its contents are not stored on disk
Show answer and explanation
Answer: C. It is a virtual file system through which the kernel shows running processes and the system state as files; its contents are not stored on disk
/proc is a virtual file system called procfs: each time a file is read, the kernel generates the information as of that moment. cat /proc/cpuinfo shows the CPU model and number of cores, cat /proc/meminfo shows memory usage, and /proc/<process ID>/ holds information on each process. Because the files do not exist on disk, many of them are shown with a size of 0. It is also often used on servers that run EDA tools, to check the number of CPU cores and the amount of memory.
- A. Configuration files are kept in /etc. /proc is not a place for storing files.
- B. Device files are kept in /dev (/dev/sda, /dev/null and so on).
- C. Correct. It is a virtual file system whose contents the kernel generates each time they are read.