Javatpoint Logo
Javatpoint Logo

Linux Memory Directory

Memory directory contains files of the whole system. All the device information, process running indata or system related information are stored in this directory.

Memory directory contains the following directories.

  • /dev
  • /proc
  • /sys

/dev

The term 'dev' is short for device. As you know in Linux operating system everything is a file. It appears to be an ordinary file but doesn't take up disk space. Files which are used to represent and access devices are stored here including terminal devices like usb. All the files stored in '/dev' are not related to real devices, some are related to virtual devices also.

  • /dev/tty and /dev/pts: The '/dev/tty' file represents the command line interface that is a terminl or console attached to the system. Typing commands in a terminal is a part of the graphical interface like Gnome or KDE, then terminal will be represented as '/dev/pts/1' (here 1 is replacable by any another number).
  • /dev/null: The '/dev/null' file is considered as black hole, it has unlimited storage but nothing can be retrieved from it. You can discard your unwanted output from the terminal but can't retrieve it back.

/proc

The term 'proc' is short for process. Same as '/dev', '/proc' also doesn't take up disk space. It contains process information. It is a pseudo filesystem that contains information about running processes. It also works as virtual filesystem containing text information about system resources.

  • /proc conversation with the kernel: The '/proc' displays view of the kernel, what the kernel manages and it is a means to directly communicate with the kernel.
  • Example:

    Linux fhs Memory Directory

    Look at the above snapshot, command "ls /proc" displays content of '/proc'. Many files are named as numbers and some named files are also there.

    The '/proc' has some file properties like date, which keeps on updating as shown in the below snapshot.

    Linux fhs Memory Directory

    Also most of the files in '/proc' are of 0 bytes yet they contain a lot of data. Most of the files are readable only, some require root privileges and some are writable.

  • /proc/interrupts: The '/proc/interrupts' displays the interrupt.
  • Example:

    Linux fhs Memory Directory

    Look at the above snapshot, when a system have two CPUs, files will look like this.

/sys

The term 'sys' is short for system. Basically it contains kernel information about hardware. It was created for Linux 2.6 kernel. It is a kind of '/proc' and is used for plug and play configuration.





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA