Proc File System Sadi Evren SEKER Proc FS

  • Slides: 12
Download presentation
Proc File System Sadi Evren SEKER

Proc File System Sadi Evren SEKER

Proc FS /proc directory is NOT a real File System It is a Virtual

Proc FS /proc directory is NOT a real File System It is a Virtual File System information about processes and other system information. • It is mapped to /proc and mounted at boot time. • •

Discovering around • # cd /proc • The first thing that you will notice

Discovering around • # cd /proc • The first thing that you will notice is that there are some familiar sounding files, and then a whole bunch of numbered directories. The numbered directories represent processes, better known as PIDs, and within them, a command that occupies them. The files contain system information such as memory (meminfo), CPU information (cpuinfo), and available filesystems.

meminfo • # cat /proc/meminfo • As you can see, /proc/meminfo contains a bunch

meminfo • # cat /proc/meminfo • As you can see, /proc/meminfo contains a bunch of information about your system’s memory, including the total amount available (in kb) and the amount free on the top two lines.

Man Pages • # man 5 /proc/<filename>

Man Pages • # man 5 /proc/<filename>

List of Files • • • tty. /proc/cmdline – Kernel command line information. /proc/console

List of Files • • • tty. /proc/cmdline – Kernel command line information. /proc/console – Information about current consoles including /proc/devices – Device drivers currently configured for the running kernel. /proc/dma – Info about current DMA channels. /proc/fb – Framebuffer devices. /proc/filesystems – Current filesystems supported by the kernel. /proc/iomem – Current system memory map for devices. /proc/ioports – Registered port regions for input output communication with device. /proc/loadavg – System load average.

List of Files (continue) • • • /proc/locks – Files currently locked by kernel.

List of Files (continue) • • • /proc/locks – Files currently locked by kernel. /proc/meminfo – Info about system memory (see above example). /proc/misc – Miscellaneous drivers registered for miscellaneous major device. /proc/modules – Currently loaded kernel modules. /proc/mounts – List of all mounts in use by system. /proc/partitions – Detailed info about partitions available to the system. /proc/pci – Information about every PCI device. /proc/stat – Record or various statistics kept from last reboot. /proc/swap – Information about swap space. /proc/uptime – Uptime information (in seconds). /proc/version – Kernel version, gcc version, and Linux distribution installed.

Process Info • Within /proc’s numbered directories you will find a few files and

Process Info • Within /proc’s numbered directories you will find a few files and links. Remember that these directories’ numbers correlate to the PID of the command being run within them. Let’s use an example. On my system, there is a folder name /proc/12: • #cd /proc/12 • # ls

Process Status / Details • # cat /proc/12/status

Process Status / Details • # cat /proc/12/status

Some important files • In any numbered directory, you will have a similar file

Some important files • In any numbered directory, you will have a similar file structure. The most important ones, and their descriptions, are as follows: • cmdline – command line of the process • environ – environmental variables • fd – file descriptors • limits – contains information about the limits of the process • mounts – related information • You will also notice a number of links in the numbered directory: • cwd – a link to the current working directory of the process • exe – link to the executable of the process • root – link to the work directory of the process

Some commands • uptime, lsof, mount, and ps

Some commands • uptime, lsof, mount, and ps

Assignment • The number of CPUs in your machine and their clock speed, number

Assignment • The number of CPUs in your machine and their clock speed, number of cores. • The version of Linux kernel running on your system • The time in day: hr: min: sec when the system was last booted • The average load on the system in the last 15 minutes • The total usable and currently free memory in the system • The total swap space and the currently used swap space in the system • The swap partitions and their sizes • The time the CPU spent (over all processes) in the user mode and kernel mode • The number of context switches made by the system so far • The number of interrupts handled by the system so far