The proc Directory. The most important directory

Is a Pseudo directory that resides in RAM. It provides information of all running processes and information of your system at its current state.
Each process that is launched has its own PID (Process ID) number and that number is created in the form of a file in the ‘/procdirectory. These files however are part of the Virtual Filesystem and not part of your Hard Drive.

Description/Role

Is a Pseudo directory that resides in RAM. It provides information of all running processes and information of your system at its current state.
Each process that is launched has its own PID (Process ID) number and that number is created in the form of a file in the ‘/procdirectory. These files however are part of the Virtual Filesystem and not part of your Hard Drive.

All files under /proc are dynamic and not static in order to reflect the current status of the kernel and the processes that are running. Because of its dynamic nature the /proc file system is recreated each time the machine powers up.

If you enter the /proc directory you will be able only to access the processes that were started from you, unless of course you are the root user. If a process that is launched needs to launch other child processes, a directory will be created that will contain information for the parent process along with all its child processes it had to launch.

Please note the directory with name 1. This is the first process launched when Linux boots and it is the /sbin/init process.
The remaining directories are PIDs for processes that were running at the moment the screenshot was taken.

The /proc directory also contains files that can give us information in plain text regarding the state of the system and hardware configuration. By using the cat command we can display the text contained in those files. Some of these files however keep changing at all times.


/proc/’files’ descriptions


/proc/cpuinfo

CPU information. Here information about the type of processor, vendor, model name, speed, cache size, number of cores and forth is displayed.
This is an example output. Please note the number zero next to ‘processor’ stands actually for CPU 1. This system is actual a Dual Core but the rest of the output has been left out in order to conserve space in the page.
You can also get information about your CPU by running the uname -i command.

Example

root@home ~# cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 6
model name      :               Intel(R) Pentium(R) D CPU 3.20GHz
stepping        : 5
cpu MHz         : 1200.000
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 6
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic.....cid cx16 xtpr lahf_lm
bogomips        : 6437.06
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual


/proc/partitions

Partition information. It displays information regarding size of all of your partitions, their names, along with their minor and major numbers.
During access of a device file in order to perform an input/output operation, the major number selects which device will be activated. The decision is made by the use of the minor number.

Example

root@home ~# cat /proc/partitions

 major minor  #blocks  name
  8     0    312571224 sda
  8     1       104391 sda1
  8     2    204796620 sda2
  8     3      5116702 sda3
  8     4            1 sda4
  8     5    102550896 sda5


/proc/swaps

Swap partition information. It provides information regarding the Filename, Type, Size, Amount Used and priority of your swap partition(s). The priority number of your swap partitions determine which one will be used first before the other partitions kick in.

Example

root@home# cat /proc/swaps

Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       5116692 0       -1
/dev/sdb1                               partition       5164888 0       -2


/proc/irq/

IRQ information. This is actually a directory that has subdirectories for each IRQ channel.


/proc/modules

Information for currently loaded Kernel modules. The Linux kernel can either be monolithic or modular in the way how the drivers are configured. A monolithic kernel is faster but is large which means it consumes more resources. A modular kernel is slower but it preservers resources. In a modular kernel the drivers are loaded and unloaded as modules when they are needed.

Example

roott@home# cat /proc/modules

autofs4 32841 2 - Live 0xffffffff88c73000
hidp 38209 0 - Live 0xffffffff88c68000
rfcomm 57961 0 - Live 0xffffffff88c58000
l2cap 41025 4 hidp,rfcomm, Live 0xffffffff88c4c000
bluetooth 73541 5 hidp,rfcomm,l2cap, Live 0xffffffff88c39000
vmnet 54592 13 - Live 0xffffffff88c2a000 (P)
vmblock 25032 3 - Live 0xffffffff88c22000 (P)
vmmon 1843756 0 - Live 0xffffffff88a5e000 (P)
sunrpc 191305 1 - Live 0xffffffff88a2e000


/proc/DMA

Which DMA channels are used. Unfortunately all of my devices are of SCSI type so I cannnot provide an example output.


/proc/vmstat

WIKI ENTRY PENDING FOR ENTRY!


/proc/iomem

It is made of 5 fields. First three fields show load average on intervals of 1, 5 and 15 minutes. Fourth field shows processes that are scheduled to run and total number processes on the system. Fifth field is the PID of the process that was run most recently.
If you have a Dual Core CPU, having a number above 2 would mean that there are tasks waiting for the CPU to devote time to them. This type of situation is not bad by default. Some processes for example are of lower priority than other tasks. Example

root@home# cat /proc/loadavg

   0.24 0.26 0.22  2/192  15482
   |_|____|____|_|-|____|-|____|
     |    |    |     |       |
     v    |    |     |       |----------------------->PID number.
    1min  v    |     |---->Process scheduled to run.
          5min v
               15min
---------------------
  I n t e r v a l s


/proc/locks

Shows files that are being locked by the Kernel. The format is composed by 8 fields.
Example

root@home# cat /proc/locks

 1:  POSIX   ADVISORY   WRITE    4183   08:12:49283428   0 EOF
 2:  POSIX   ADVISORY   WRITE    4141   08:02:18513990   0 EOF
 3:  POSIX   ADVISORY   WRITE    3285   08:05:3735611    0 EOF
|_|-|_____|--|______|---|____|---|__|---|____________|---|____|
 |    |         |         |       |           |            |
 1    2         3         4       5           6           7-8
  • 1st field: Each lock has its own unique ID number.
  • 2nd field: Class of lock used. FLOCK is the old UNIX like locks. POSIX are the newer file locks from the lockf system call.
  • 3rd field: Displays if a file is still accessible by other users. ADVISORY means that data can be accessed by other users.MANDATORY other users cannot access the data.
  • 4th field: Displays if the holder can still either READ or WRITE data on the locked file.
  • 5th field: Shows the ID of the procerss of the file being locked
  • 6th field: Shows the ID of the file being locked in the format of MAJOR-DEVICE:MINOR-DEVICE:INODE-NUMBER. TheMAJOR-DEVICE:MINOR-DEVICE is the device that has the file.
  • 7th and 8th field: Displays the file’s beginning and end of the file’s locked region.


/proc/cmdline

Information regarding the options that were passed to the kernel at the start of Boot time.
Example

root@home# cat /proc/cmdline
ro root=LABEL=/ rhgb quiet

]

/proc/filesystems

Information about which filesystems are being supported by the kernel the way it is configured at the current moment.

Example

root@home# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
.
.
.
nodev   ramfs
nodev   hugetlbfs
       iso9660
nodev   mqueue
nodev   selinuxfs
       ext3
       vfat


/proc/meminfo

This file has information regarding the state of your memory. The following is a summary of the actual output.

root@home ~#  cat /proc/meminfo
MemTotal:      2061396 kB
MemFree:         26484 kB
Buffers:        628940 kB
Cached:         606840 kB
SwapCached:          0 kB
Active:        1043984 kB
Inactive:       707508 kB
SwapTotal:    10281580 kB
SwapFree:     10281580 kB
Dirty:              96 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

Share Button

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.