<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="Asciidoctor 2.0.12"> <meta name="description" content="Intro and Install"> <meta name="keywords" content="Linux, apt"> <meta name="author" content="Apostolos rootApostolos@swarmlab.io"> <title>An Introduction to Linux !</title> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/css/asciidoctor.min.css"> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/styles/github.min.css"> </head> <body class="article toc2 toc-right"> <div id="header"> <h1>An Introduction to Linux !</h1> <div class="details"> <span id="author" class="author">Apostolos rootApostolos@swarmlab.io</span><br> </div> <div id="toc" class="toc2"> <div id="toctitle">Table of contents</div> <ul class="sectlevel1"> <li><a href="#_the_proc_filesystem">1. The /proc Filesystem</a></li> <li><a href="#_cpu_info">2. cpu info</a></li> </ul> </div> </div> <div id="content"> <div id="preamble"> <div class="sectionbody"> <div class="paragraph"> <p><br></p> </div> <div class="sidebarblock"> <div class="content"> <div class="title">procfs</div> <div class="paragraph"> <p>The proc filesystem (<strong>procfs</strong>) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, <strong>providing</strong> a more convenient and <strong>standardized method for dynamically accessing process</strong> data held in the kernel than traditional tracing methods or direct access to kernel memory.</p> </div> <div class="paragraph"> <p>Typically</p> </div> <div class="ulist"> <ul> <li> <p>it is mapped to a mount point named /proc at boot time.</p> </li> <li> <p>The proc file system acts as an interface to internal data structures in the kernel.</p> </li> <li> <p>It can be used to obtain information about the system and to change certain kernel parameters at runtime (sysctl).</p> </li> </ul> </div> </div> </div> </div> </div> <div class="sect1"> <h2 id="_the_proc_filesystem">1. The /proc Filesystem</h2> <div class="sectionbody"> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> The proc filesystem provides a method of communication between <strong>kernel space</strong> and <strong>user space</strong>. For example, the GNU version of the process reporting utility <strong>ps</strong> uses the proc file system to obtain its data, without using any specialized system calls. </td> </tr> </table> </div> <div class="paragraph"> <p>The directory /proc contains (among other things) one subdirectory for each process running on the system, which is named after the process ID (PID).</p> </div> <div class="paragraph"> <p>The link ‘self’ points to the process reading the file system. Each process subdirectory has the entries listed in: ls /proc/<pid></p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">cat /proc/meminfo MemTotal: 8174328 kB MemFree: 6186516 kB MemAvailable: 7535332 kB Buffers: 146740 kB Cached: 1294156 kB SwapCached: 0 kB Active: 967184 kB Inactive: 606252 kB Active(anon): 135620 kB Inactive(anon): 85064 kB Active(file): 831564 kB Inactive(file): 521188 kB Unevictable: 3652 kB Mlocked: 3652 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 68 kB Writeback: 0 kB AnonPages: 136188 kB Mapped: 113344 kB Shmem: 85724 kB Slab: 340236 kB SReclaimable: 302048 kB SUnreclaim: 38188 kB KernelStack: 3792 kB PageTables: 4888 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 4087164 kB Committed_AS: 901432 kB VmallocTotal: 34359738367 kB VmallocUsed: 0 kB VmallocChunk: 0 kB HardwareCorrupted: 0 kB AnonHugePages: 51200 kB CmaTotal: 0 kB CmaFree: 0 kB ...</code></pre> </div> </div> <table class="tableblock frame-all grid-all stretch"> <caption class="title">Table 1. Main entries in /proc</caption> <colgroup> <col style="width: 50%;"> <col style="width: 50%;"> </colgroup> <thead> <tr> <th class="tableblock halign-left valign-top">File</th> <th class="tableblock halign-left valign-top">Content</th> </tr> </thead> <tbody> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/cmdline</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Kernel command line information.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/console</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Information about current consoles including tty.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/crypto</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- a list of available cryptographic modules</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/devices</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Device drivers currently configured for the running kernel.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/diskstats</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- giving some information (including device numbers) for each of the logical disk devices</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/dma</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Info about current DMA channels.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/fb</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Framebuffer devices.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/filesystems</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Current filesystems supported by the kernel.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/interrupts, /proc/iomem, /proc/ioports and the directory /proc/irq</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- giving some self-explanatory details about the devices (physical or logical) using the various system resources</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/iomem</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Current system memory map for devices.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/ioports</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Registered port regions for input output communication with device.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/loadavg</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– System load average.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/locks</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Files currently locked by kernel.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/meminfo</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Info about system memory (see above example).</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/misc</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Miscellaneous drivers registered for miscellaneous major device.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/modules</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- one of the most important files in /proc, containing a list of the kernel modules currently loaded . It gives some indication (not always entirely correct) of dependencies.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/mounts</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– List of all mounts in use by system.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/mounts</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- a symlink to self/mounts which contains a list of the currently mounted devices and their mount points (and which file system is in use and what mount options are in use).</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/net</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- a directory containing useful information about the network stack, in particular /proc/net/nf_conntrack, which lists existing network connections (particularly useful for tracking routing when iptables FORWARD is used to redirect network connections)</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/partitions</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Detailed info about partitions available to the system.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/pci</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Information about every PCI device.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/stat</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Record or various statistics kept from last reboot.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/swap</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Information about swap space.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/scsi</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- giving information about any devices connected via a SCSI or RAID controller</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/sysvipc</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- containing memory-sharing and inter-process communication (IPC) information.</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/tty</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">- containing information about the current terminals; /proc/tty/driver looks to be[original research?] a list of the different types of tty available - each of which is a list of those of each type</p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/uptime</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Uptime information (in seconds).</p></td> </tr> </tbody> <tfoot> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">/proc/version</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">– Kernel version, gcc version, and Linux distribution installed.</p></td> </tr> </tfoot> </table> </div> </div> <div class="sect1"> <h2 id="_cpu_info">2. cpu info</h2> <div class="sectionbody"> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 270 Processor stepping : 3 microcode : 0x10000c8 cpu MHz : 2000.000 cache size : 1024 KB ... processor : 1 vendor_id : AuthenticAMD cpu family : 16 model : 6 model name : AMD Athlon(tm) II X2 270 Processor stepping : 3 microcode : 0x10000c8 cpu MHz : 800.000 cache size : 1024 KB</code></pre> </div> </div> </div> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script> <script> if (!hljs.initHighlighting.called) { hljs.initHighlighting.called = true ;[].slice.call(document.querySelectorAll('pre.highlight > code')).forEach(function (el) { hljs.highlightBlock(el) }) } </script> </body> </html>