[{"data":1,"prerenderedAt":1168},["ShallowReactive",2],{"/blog/os-fundamentals":3},{"id":4,"title":5,"bannerImage":6,"body":7,"date":1156,"description":1157,"extension":1158,"meta":1159,"navigation":201,"path":1161,"seo":1162,"stem":1163,"tags":1164,"__hash__":1167},"posts/blog/os-fundamentals.md","OS Fundamentals","https://devopsdiary.site/blog/os-fundamentals.png",{"type":8,"value":9,"toc":1146},"minimark",[10,14,17,25,28,33,36,39,59,62,64,68,71,81,103,106,120,123,156,173,175,179,185,420,422,436,439,441,445,448,575,577,584,590,592,596,599,731,733,750,753,755,759,762,869,871,901,904,906,910,913,1042,1044,1051,1058,1064,1066,1070,1073,1081,1084,1087,1110,1112,1142],[11,12,13],"p",{},"Before doing anything with Docker, before writing a single Terraform file, before configuring a CI/CD pipeline, there is a layer on which everything runs. That layer is the operating system.",[11,15,16],{},"And for a DevOps engineer, Linux is that operating system.",[11,18,19,20,24],{},"This is Task 02 of the DevOpsDiary beginner path. The deliverable is a Bash script called ",[21,22,23],"code",{},"os-info.sh"," that collects and displays detailed information about the system it runs on. By the end of this post, you will understand not only how to build that script, but why each piece of information it collects actually matters.",[26,27],"hr",{},[29,30,32],"h2",{"id":31},"what-an-operating-system-actually-does","What an Operating System Actually Does",[11,34,35],{},"Most people interact with an operating system through a graphical interface and never think much beyond that. But when you manage infrastructure, the mental model you need is different.",[11,37,38],{},"An operating system is the software that sits between the hardware and everything else. It manages physical resources like CPU time, memory pages, disk blocks, and network interfaces, and exposes them to processes through a layer of abstractions. You do not write directly to RAM. You do not talk directly to the network card. You ask the kernel, and the kernel decides what to do.",[11,40,41,42,46,47,50,51,54,55,58],{},"The ",[43,44,45],"strong",{},"kernel"," is the core of the operating system. It runs in privileged mode, controlling the hardware directly. Everything else, including your shell, your web server, and your Python script, runs in ",[43,48,49],{},"userspace",", making requests to the kernel through a defined interface called system calls. When your script opens a file, it calls ",[21,52,53],{},"open()",". When it forks a new process, it calls ",[21,56,57],{},"fork()",". The kernel handles the rest.",[11,60,61],{},"Linux specifically is a monolithic kernel originally written by Linus Torvalds in 1991. Today it runs on most servers in the world, on every Android device, and on a large portion of developer workstations.",[26,63],{},[29,65,67],{"id":66},"the-proc-filesystem-the-kernel-talking-directly-to-you","The /proc Filesystem: The Kernel Talking Directly to You",[11,69,70],{},"One of the most important concepts in Linux is that everything is a file.",[11,72,41,73,76,77,80],{},[21,74,75],{},"/proc"," filesystem is a virtual filesystem, which means it does not exist on disk. It is created by the kernel in memory and represents the live state of the running system. When you read ",[21,78,79],{},"/proc/meminfo",", you are not reading a file that some daemon updated five minutes ago. You are reading the kernel's current understanding of memory usage, at the exact moment of reading.",[82,83,88],"pre",{"className":84,"code":85,"language":86,"meta":87,"style":87},"language-bash shiki shiki-themes github-light github-dark","cat /proc/meminfo\n","bash","",[21,89,90],{"__ignoreMap":87},[91,92,95,99],"span",{"class":93,"line":94},"line",1,[91,96,98],{"class":97},"sScJk","cat",[91,100,102],{"class":101},"sZZnC"," /proc/meminfo\n",[104,105],"br",{},[11,107,108,109,112,113,116,117,119],{},"That single command is the foundation of tools like ",[21,110,111],{},"free",", ",[21,114,115],{},"htop",", and practically every monitoring agent you will ever deploy. Understanding ",[21,118,75],{}," means understanding where the data actually comes from.",[11,121,122],{},"Important files worth knowing:",[124,125,126,133,138,144,150],"ul",{},[127,128,129,132],"li",{},[21,130,131],{},"/proc/cpuinfo",": details about each CPU core",[127,134,135,137],{},[21,136,79],{},": memory statistics",[127,139,140,143],{},[21,141,142],{},"/proc/uptime",": system uptime in seconds",[127,145,146,149],{},[21,147,148],{},"/proc/loadavg",": load averages for 1, 5, and 15 minutes",[127,151,152,155],{},[21,153,154],{},"/proc/[PID]/",": a directory for each running process, containing its status, open file descriptors, memory maps, and more",[11,157,158,159,162,163,165,166,169,170,172],{},"When you run ",[21,160,161],{},"ps aux",", it reads ",[21,164,75],{},". When ",[21,167,168],{},"top"," updates every second, it reads ",[21,171,75],{},". This virtual filesystem is the source of truth for system state in Linux.",[26,174],{},[29,176,178],{"id":177},"system-identification","System Identification",[11,180,181,182,184],{},"The first section of ",[21,183,23],{}," is about identity. Before diagnosing anything, you need to know exactly what system you are on.",[82,186,188],{"className":84,"code":187,"language":86,"meta":87,"style":87},"#!/bin/bash\n\nTIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')\n\necho \"======================================\"\necho \"  SYSTEM REPORT - $TIMESTAMP\"\necho \"======================================\"\n\necho \"\"\necho \"[ SYSTEM IDENTIFICATION ]\"\necho \"\"\n\nif [ -f /etc/os-release ]; then\n    . /etc/os-release\n    echo \"Distribution : $PRETTY_NAME\"\nfi\n\necho \"Kernel       : $(uname -r)\"\necho \"Architecture : $(uname -m)\"\necho \"Hostname     : $(hostname)\"\necho \"FQDN         : $(hostname -f 2>/dev/null || echo 'N/A')\"\n",[21,189,190,196,203,226,231,241,255,262,267,275,283,290,295,313,322,336,342,347,364,379,392],{"__ignoreMap":87},[91,191,192],{"class":93,"line":94},[91,193,195],{"class":194},"sJ8bj","#!/bin/bash\n",[91,197,199],{"class":93,"line":198},2,[91,200,202],{"emptyLinePlaceholder":201},true,"\n",[91,204,206,210,214,217,220,223],{"class":93,"line":205},3,[91,207,209],{"class":208},"sVt8B","TIMESTAMP",[91,211,213],{"class":212},"szBVR","=",[91,215,216],{"class":208},"$(",[91,218,219],{"class":97},"date",[91,221,222],{"class":101}," '+%Y-%m-%d %H:%M:%S'",[91,224,225],{"class":208},")\n",[91,227,229],{"class":93,"line":228},4,[91,230,202],{"emptyLinePlaceholder":201},[91,232,234,238],{"class":93,"line":233},5,[91,235,237],{"class":236},"sj4cs","echo",[91,239,240],{"class":101}," \"======================================\"\n",[91,242,244,246,249,252],{"class":93,"line":243},6,[91,245,237],{"class":236},[91,247,248],{"class":101}," \"  SYSTEM REPORT - ",[91,250,251],{"class":208},"$TIMESTAMP",[91,253,254],{"class":101},"\"\n",[91,256,258,260],{"class":93,"line":257},7,[91,259,237],{"class":236},[91,261,240],{"class":101},[91,263,265],{"class":93,"line":264},8,[91,266,202],{"emptyLinePlaceholder":201},[91,268,270,272],{"class":93,"line":269},9,[91,271,237],{"class":236},[91,273,274],{"class":101}," \"\"\n",[91,276,278,280],{"class":93,"line":277},10,[91,279,237],{"class":236},[91,281,282],{"class":101}," \"[ SYSTEM IDENTIFICATION ]\"\n",[91,284,286,288],{"class":93,"line":285},11,[91,287,237],{"class":236},[91,289,274],{"class":101},[91,291,293],{"class":93,"line":292},12,[91,294,202],{"emptyLinePlaceholder":201},[91,296,298,301,304,307,310],{"class":93,"line":297},13,[91,299,300],{"class":212},"if",[91,302,303],{"class":208}," [ ",[91,305,306],{"class":212},"-f",[91,308,309],{"class":208}," /etc/os-release ]; ",[91,311,312],{"class":212},"then\n",[91,314,316,319],{"class":93,"line":315},14,[91,317,318],{"class":236},"    .",[91,320,321],{"class":101}," /etc/os-release\n",[91,323,325,328,331,334],{"class":93,"line":324},15,[91,326,327],{"class":236},"    echo",[91,329,330],{"class":101}," \"Distribution : ",[91,332,333],{"class":208},"$PRETTY_NAME",[91,335,254],{"class":101},[91,337,339],{"class":93,"line":338},16,[91,340,341],{"class":212},"fi\n",[91,343,345],{"class":93,"line":344},17,[91,346,202],{"emptyLinePlaceholder":201},[91,348,350,352,355,358,361],{"class":93,"line":349},18,[91,351,237],{"class":236},[91,353,354],{"class":101}," \"Kernel       : $(",[91,356,357],{"class":97},"uname",[91,359,360],{"class":236}," -r",[91,362,363],{"class":101},")\"\n",[91,365,367,369,372,374,377],{"class":93,"line":366},19,[91,368,237],{"class":236},[91,370,371],{"class":101}," \"Architecture : $(",[91,373,357],{"class":97},[91,375,376],{"class":236}," -m",[91,378,363],{"class":101},[91,380,382,384,387,390],{"class":93,"line":381},20,[91,383,237],{"class":236},[91,385,386],{"class":101}," \"Hostname     : $(",[91,388,389],{"class":97},"hostname",[91,391,363],{"class":101},[91,393,395,397,400,402,405,408,411,414,417],{"class":93,"line":394},21,[91,396,237],{"class":236},[91,398,399],{"class":101}," \"FQDN         : $(",[91,401,389],{"class":97},[91,403,404],{"class":236}," -f",[91,406,407],{"class":212}," 2>",[91,409,410],{"class":101},"/dev/null ",[91,412,413],{"class":212},"||",[91,415,416],{"class":236}," echo",[91,418,419],{"class":101}," 'N/A')\"\n",[104,421],{},[11,423,41,424,427,428,431,432,435],{},[21,425,426],{},"/etc/os-release"," file is the standard way to identify a Linux distribution. You load it as a shell script because it is simply a list of ",[21,429,430],{},"KEY=VALUE"," pairs. ",[21,433,434],{},"uname -r"," gives you the running kernel version, which matters when you are checking for known vulnerabilities or confirming that a kernel update actually took effect.",[11,437,438],{},"In a real environment, you may be SSH-ing into a machine you have never touched before. Starting a diagnostic session with this information prevents a whole category of errors caused by assuming the wrong OS, the wrong architecture, or the wrong kernel.",[26,440],{},[29,442,444],{"id":443},"runtime-statistics","Runtime Statistics",[11,446,447],{},"The next section captures what the system is doing right now, not what it was doing when it booted.",[82,449,451],{"className":84,"code":450,"language":86,"meta":87,"style":87},"echo \"\"\necho \"[ RUNTIME STATISTICS ]\"\necho \"\"\n\necho \"Uptime       : $(uptime -p)\"\necho \"Load Average : $(uptime | awk -F'load average:' '{print $2}')\"\necho \"Date/Time    : $(date)\"\n\necho \"\"\necho \"Logged-in Users:\"\nwho\n\necho \"\"\necho \"Last Logins (5 most recent):\"\nlast | head -5\n",[21,452,453,459,466,472,476,491,512,523,527,533,540,545,549,555,562],{"__ignoreMap":87},[91,454,455,457],{"class":93,"line":94},[91,456,237],{"class":236},[91,458,274],{"class":101},[91,460,461,463],{"class":93,"line":198},[91,462,237],{"class":236},[91,464,465],{"class":101}," \"[ RUNTIME STATISTICS ]\"\n",[91,467,468,470],{"class":93,"line":205},[91,469,237],{"class":236},[91,471,274],{"class":101},[91,473,474],{"class":93,"line":228},[91,475,202],{"emptyLinePlaceholder":201},[91,477,478,480,483,486,489],{"class":93,"line":233},[91,479,237],{"class":236},[91,481,482],{"class":101}," \"Uptime       : $(",[91,484,485],{"class":97},"uptime",[91,487,488],{"class":236}," -p",[91,490,363],{"class":101},[91,492,493,495,498,500,503,506,509],{"class":93,"line":243},[91,494,237],{"class":236},[91,496,497],{"class":101}," \"Load Average : $(",[91,499,485],{"class":97},[91,501,502],{"class":212}," |",[91,504,505],{"class":97}," awk",[91,507,508],{"class":236}," -F",[91,510,511],{"class":101},"'load average:' '{print $2}')\"\n",[91,513,514,516,519,521],{"class":93,"line":257},[91,515,237],{"class":236},[91,517,518],{"class":101}," \"Date/Time    : $(",[91,520,219],{"class":97},[91,522,363],{"class":101},[91,524,525],{"class":93,"line":264},[91,526,202],{"emptyLinePlaceholder":201},[91,528,529,531],{"class":93,"line":269},[91,530,237],{"class":236},[91,532,274],{"class":101},[91,534,535,537],{"class":93,"line":277},[91,536,237],{"class":236},[91,538,539],{"class":101}," \"Logged-in Users:\"\n",[91,541,542],{"class":93,"line":285},[91,543,544],{"class":97},"who\n",[91,546,547],{"class":93,"line":292},[91,548,202],{"emptyLinePlaceholder":201},[91,550,551,553],{"class":93,"line":297},[91,552,237],{"class":236},[91,554,274],{"class":101},[91,556,557,559],{"class":93,"line":315},[91,558,237],{"class":236},[91,560,561],{"class":101}," \"Last Logins (5 most recent):\"\n",[91,563,564,567,569,572],{"class":93,"line":324},[91,565,566],{"class":97},"last",[91,568,502],{"class":212},[91,570,571],{"class":97}," head",[91,573,574],{"class":236}," -5\n",[104,576],{},[11,578,579,580,583],{},"Load average deserves attention. It represents the average number of processes that are running or waiting to run over the last 1, 5, and 15 minutes. A load average of ",[21,581,582],{},"1.0"," on a single-core machine means the CPU is fully busy. The same value on an 8-core machine means it is barely being used. Always compare the load average against the number of CPU cores.",[11,585,586,587,589],{},"A load average persistently above the number of cores is the first signal that something is wrong. This is not an alert you need a monitoring platform to see. Running ",[21,588,485],{}," tells you instantly.",[26,591],{},[29,593,595],{"id":594},"process-information-what-is-actually-running","Process Information: What Is Actually Running",[11,597,598],{},"Every piece of software running on a Linux system is a process. Processes have a PID, a parent PID, an owner, a state, and resource consumption metrics. Understanding processes means understanding what the system is actually doing.",[82,600,602],{"className":84,"code":601,"language":86,"meta":87,"style":87},"echo \"\"\necho \"[ PROCESS INFORMATION ]\"\necho \"\"\n\necho \"Total Processes: $(ps aux | wc -l)\"\necho \"\"\n\necho \"Top 5 by CPU:\"\nps aux --sort=-%cpu | awk 'NR==1 || NR\u003C=6' | awk '{printf \"%-10s %-8s %-8s %s\\n\", $1, $2, $3, $11}'\n\necho \"\"\necho \"Top 5 by Memory:\"\nps aux --sort=-%mem | awk 'NR==1 || NR\u003C=6' | awk '{printf \"%-10s %-8s %-8s %s\\n\", $1, $2, $4, $11}'\n",[21,603,604,610,617,623,627,651,657,661,668,692,696,702,709],{"__ignoreMap":87},[91,605,606,608],{"class":93,"line":94},[91,607,237],{"class":236},[91,609,274],{"class":101},[91,611,612,614],{"class":93,"line":198},[91,613,237],{"class":236},[91,615,616],{"class":101}," \"[ PROCESS INFORMATION ]\"\n",[91,618,619,621],{"class":93,"line":205},[91,620,237],{"class":236},[91,622,274],{"class":101},[91,624,625],{"class":93,"line":228},[91,626,202],{"emptyLinePlaceholder":201},[91,628,629,631,634,637,640,643,646,649],{"class":93,"line":233},[91,630,237],{"class":236},[91,632,633],{"class":101}," \"Total Processes: $(",[91,635,636],{"class":97},"ps",[91,638,639],{"class":101}," aux ",[91,641,642],{"class":212},"|",[91,644,645],{"class":97}," wc",[91,647,648],{"class":236}," -l",[91,650,363],{"class":101},[91,652,653,655],{"class":93,"line":243},[91,654,237],{"class":236},[91,656,274],{"class":101},[91,658,659],{"class":93,"line":257},[91,660,202],{"emptyLinePlaceholder":201},[91,662,663,665],{"class":93,"line":264},[91,664,237],{"class":236},[91,666,667],{"class":101}," \"Top 5 by CPU:\"\n",[91,669,670,672,675,678,680,682,685,687,689],{"class":93,"line":269},[91,671,636],{"class":97},[91,673,674],{"class":101}," aux",[91,676,677],{"class":236}," --sort=-%cpu",[91,679,502],{"class":212},[91,681,505],{"class":97},[91,683,684],{"class":101}," 'NR==1 || NR\u003C=6'",[91,686,502],{"class":212},[91,688,505],{"class":97},[91,690,691],{"class":101}," '{printf \"%-10s %-8s %-8s %s\\n\", $1, $2, $3, $11}'\n",[91,693,694],{"class":93,"line":277},[91,695,202],{"emptyLinePlaceholder":201},[91,697,698,700],{"class":93,"line":285},[91,699,237],{"class":236},[91,701,274],{"class":101},[91,703,704,706],{"class":93,"line":292},[91,705,237],{"class":236},[91,707,708],{"class":101}," \"Top 5 by Memory:\"\n",[91,710,711,713,715,718,720,722,724,726,728],{"class":93,"line":297},[91,712,636],{"class":97},[91,714,674],{"class":101},[91,716,717],{"class":236}," --sort=-%mem",[91,719,502],{"class":212},[91,721,505],{"class":97},[91,723,684],{"class":101},[91,725,502],{"class":212},[91,727,505],{"class":97},[91,729,730],{"class":101}," '{printf \"%-10s %-8s %-8s %s\\n\", $1, $2, $4, $11}'\n",[104,732],{},[11,734,41,735,737,738,741,742,745,746,749],{},[21,736,161],{}," flags mean: ",[21,739,740],{},"a"," shows processes from all users, ",[21,743,744],{},"u"," uses a user-oriented format with CPU and memory percentages, ",[21,747,748],{},"x"," includes processes not attached to a terminal.",[11,751,752],{},"During a production incident, checking which process is consuming unexpected resources is standard procedure. This section of the script gives you that answer in seconds.",[26,754],{},[29,756,758],{"id":757},"memory-usage-understanding-what-procmeminfo-is-telling-you","Memory Usage: Understanding What /proc/meminfo Is Telling You",[11,760,761],{},"Memory management in Linux is frequently misunderstood. The most common misconception is thinking that high memory usage is a problem. It is not. Idle RAM is wasted RAM. Linux actively caches file data in memory to speed up reads, and releases that cache when a process actually needs the memory.",[82,763,765],{"className":84,"code":764,"language":86,"meta":87,"style":87},"echo \"\"\necho \"[ MEMORY USAGE ]\"\necho \"\"\n\necho \"Memory Overview:\"\nfree -h\n\necho \"\"\necho \"Swap:\"\nswapon --show 2>/dev/null || echo \"No swap configured\"\n\necho \"\"\necho \"Key metrics from /proc/meminfo:\"\nawk '/MemTotal|MemAvailable|MemFree|Cached|SwapTotal|SwapFree/ {printf \"%-20s %s\\n\", $1, $2\" \"$3}' /proc/meminfo\n",[21,766,767,773,780,786,790,797,804,808,814,821,842,846,852,859],{"__ignoreMap":87},[91,768,769,771],{"class":93,"line":94},[91,770,237],{"class":236},[91,772,274],{"class":101},[91,774,775,777],{"class":93,"line":198},[91,776,237],{"class":236},[91,778,779],{"class":101}," \"[ MEMORY USAGE ]\"\n",[91,781,782,784],{"class":93,"line":205},[91,783,237],{"class":236},[91,785,274],{"class":101},[91,787,788],{"class":93,"line":228},[91,789,202],{"emptyLinePlaceholder":201},[91,791,792,794],{"class":93,"line":233},[91,793,237],{"class":236},[91,795,796],{"class":101}," \"Memory Overview:\"\n",[91,798,799,801],{"class":93,"line":243},[91,800,111],{"class":97},[91,802,803],{"class":236}," -h\n",[91,805,806],{"class":93,"line":257},[91,807,202],{"emptyLinePlaceholder":201},[91,809,810,812],{"class":93,"line":264},[91,811,237],{"class":236},[91,813,274],{"class":101},[91,815,816,818],{"class":93,"line":269},[91,817,237],{"class":236},[91,819,820],{"class":101}," \"Swap:\"\n",[91,822,823,826,829,831,834,837,839],{"class":93,"line":277},[91,824,825],{"class":97},"swapon",[91,827,828],{"class":236}," --show",[91,830,407],{"class":212},[91,832,833],{"class":101},"/dev/null",[91,835,836],{"class":212}," ||",[91,838,416],{"class":236},[91,840,841],{"class":101}," \"No swap configured\"\n",[91,843,844],{"class":93,"line":285},[91,845,202],{"emptyLinePlaceholder":201},[91,847,848,850],{"class":93,"line":292},[91,849,237],{"class":236},[91,851,274],{"class":101},[91,853,854,856],{"class":93,"line":297},[91,855,237],{"class":236},[91,857,858],{"class":101}," \"Key metrics from /proc/meminfo:\"\n",[91,860,861,864,867],{"class":93,"line":315},[91,862,863],{"class":97},"awk",[91,865,866],{"class":101}," '/MemTotal|MemAvailable|MemFree|Cached|SwapTotal|SwapFree/ {printf \"%-20s %s\\n\", $1, $2\" \"$3}'",[91,868,102],{"class":101},[104,870],{},[11,872,873,874,877,878,881,882,885,886,888,889,891,892,894,895,897,898,900],{},"The numbers that actually matter in ",[21,875,876],{},"free -h"," are ",[21,879,880],{},"MemTotal"," and ",[21,883,884],{},"available",". Not ",[21,887,111],{},". The ",[21,890,884],{}," column is an estimate of how much memory is available for new processes, accounting for reclaimable cache. ",[21,893,111],{}," (the raw column) shows only completely idle memory, which tends to sit near zero on a healthy, busy system. Seeing ",[21,896,111],{}," near zero is not a problem. Seeing ",[21,899,884],{}," near zero is.",[11,902,903],{},"Swap is disk space used as memory overflow. When a process needs memory and RAM is full, the kernel moves less-used pages to swap. Swap activity is expensive because disk I/O is orders of magnitude slower than RAM. Persistent heavy swap usage, known as thrashing, is a serious performance problem.",[26,905],{},[29,907,909],{"id":908},"storage-information-disk-usage-and-inodes","Storage Information: Disk Usage and Inodes",[11,911,912],{},"Disk space is finite and filesystems can fill up in ways that are not always obvious from a single number.",[82,914,916],{"className":84,"code":915,"language":86,"meta":87,"style":87},"echo \"\"\necho \"[ STORAGE INFORMATION ]\"\necho \"\"\n\necho \"Disk Usage by Filesystem:\"\ndf -h --output=source,fstype,size,used,avail,pcent,target | column -t\n\necho \"\"\necho \"Disk Usage by Directory:\"\ndu -sh /var /home /opt /tmp 2>/dev/null\n\necho \"\"\necho \"Inode Usage:\"\ndf -i --output=source,iused,ifree,ipcent,target | column -t\n",[21,917,918,924,931,937,941,948,967,971,977,984,1009,1013,1019,1026],{"__ignoreMap":87},[91,919,920,922],{"class":93,"line":94},[91,921,237],{"class":236},[91,923,274],{"class":101},[91,925,926,928],{"class":93,"line":198},[91,927,237],{"class":236},[91,929,930],{"class":101}," \"[ STORAGE INFORMATION ]\"\n",[91,932,933,935],{"class":93,"line":205},[91,934,237],{"class":236},[91,936,274],{"class":101},[91,938,939],{"class":93,"line":228},[91,940,202],{"emptyLinePlaceholder":201},[91,942,943,945],{"class":93,"line":233},[91,944,237],{"class":236},[91,946,947],{"class":101}," \"Disk Usage by Filesystem:\"\n",[91,949,950,953,956,959,961,964],{"class":93,"line":243},[91,951,952],{"class":97},"df",[91,954,955],{"class":236}," -h",[91,957,958],{"class":236}," --output=source,fstype,size,used,avail,pcent,target",[91,960,502],{"class":212},[91,962,963],{"class":97}," column",[91,965,966],{"class":236}," -t\n",[91,968,969],{"class":93,"line":257},[91,970,202],{"emptyLinePlaceholder":201},[91,972,973,975],{"class":93,"line":264},[91,974,237],{"class":236},[91,976,274],{"class":101},[91,978,979,981],{"class":93,"line":269},[91,980,237],{"class":236},[91,982,983],{"class":101}," \"Disk Usage by Directory:\"\n",[91,985,986,989,992,995,998,1001,1004,1006],{"class":93,"line":277},[91,987,988],{"class":97},"du",[91,990,991],{"class":236}," -sh",[91,993,994],{"class":101}," /var",[91,996,997],{"class":101}," /home",[91,999,1000],{"class":101}," /opt",[91,1002,1003],{"class":101}," /tmp",[91,1005,407],{"class":212},[91,1007,1008],{"class":101},"/dev/null\n",[91,1010,1011],{"class":93,"line":285},[91,1012,202],{"emptyLinePlaceholder":201},[91,1014,1015,1017],{"class":93,"line":292},[91,1016,237],{"class":236},[91,1018,274],{"class":101},[91,1020,1021,1023],{"class":93,"line":297},[91,1022,237],{"class":236},[91,1024,1025],{"class":101}," \"Inode Usage:\"\n",[91,1027,1028,1030,1033,1036,1038,1040],{"class":93,"line":315},[91,1029,952],{"class":97},[91,1031,1032],{"class":236}," -i",[91,1034,1035],{"class":236}," --output=source,iused,ifree,ipcent,target",[91,1037,502],{"class":212},[91,1039,963],{"class":97},[91,1041,966],{"class":236},[104,1043],{},[11,1045,1046,1047,1050],{},"The inode section is often overlooked. An ",[43,1048,1049],{},"inode"," is a data structure that stores metadata about a file: its permissions, owner, timestamps, and the physical locations of its data blocks on disk. Each filesystem has a fixed number of inodes, defined at creation time.",[11,1052,1053,1054,1057],{},"It is entirely possible to have free disk space but no available inodes. If you run out of inodes, you cannot create new files, even if ",[21,1055,1056],{},"df -h"," shows available space. This scenario has caused production outages on systems that generate large numbers of small files, such as mail queues, session stores, or log directories that write one file per request.",[11,1059,1060,1063],{},[21,1061,1062],{},"df -i"," shows inode usage. It belongs in any monitoring setup.",[26,1065],{},[29,1067,1069],{"id":1068},"why-os-fundamentals-matter-for-devops","Why OS Fundamentals Matter for DevOps",[11,1071,1072],{},"A common path into DevOps goes straight to the tools: Docker, Kubernetes, Terraform. Those tools are essential. But they abstract over the operating system, they do not replace it.",[11,1074,1075,1076,881,1078,1080],{},"When a container process is consuming excessive CPU, you are looking at Linux process scheduling. When a Kubernetes pod gets OOMKilled, you are looking at Linux memory management and cgroup limits. When a Terraform-managed EC2 instance stops responding, you SSH in and run ",[21,1077,161],{},[21,1079,876],{},".",[11,1082,1083],{},"The operating system does not disappear behind the abstractions. It becomes exactly what you need to understand when the abstractions fail.",[11,1085,1086],{},"This task is called OS Fundamentals because that is precisely what it is: the foundation. Every task that comes after in this path builds on what you learned here. To go deeper on operating systems, two books are essential reading:",[124,1088,1089,1104],{},[127,1090,1091,1094,1095,1101,1102],{},[43,1092,1093],{},"\"Operating Systems: Three Easy Pieces\""," by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau. Free at ",[740,1096,1100],{"href":1097,"rel":1098},"https://ostep.org",[1099],"nofollow","ostep.org",". Covers processes, memory virtualization, concurrency, and persistence with clarity and practical depth. The best starting point for anyone serious about understanding how an OS works.\n",[104,1103],{},[127,1105,1106,1109],{},[43,1107,1108],{},"\"The Linux Programming Interface\""," by Michael Kerrisk. The definitive reference for Linux system programming. It covers system calls, processes, signals, memory, filesystems, and the full POSIX API in exhaustive detail. If you want to understand what is actually happening when Linux runs your code, this is the book.",[26,1111],{},[124,1113,1114,1121,1128,1135],{},[127,1115,1116,1117],{},"Linux Kernel Documentation: ",[740,1118,1119],{"href":1119,"rel":1120},"https://www.kernel.org/doc/html/latest/",[1099],[127,1122,1123,1124],{},"Brendan Gregg: Understanding Linux Load Averages: ",[740,1125,1126],{"href":1126,"rel":1127},"https://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html",[1099],[127,1129,1130,1131],{},"Netflix Tech Blog: Linux Performance Analysis in 60,000 Milliseconds: ",[740,1132,1133],{"href":1133,"rel":1134},"https://netflixtechblog.com/linux-performance-analysis-in-60-000-milliseconds-accc10403c55",[1099],[127,1136,1137,1138],{},"Linux /proc filesystem documentation: ",[740,1139,1140],{"href":1140,"rel":1141},"https://www.kernel.org/doc/html/latest/filesystems/proc.html",[1099],[1143,1144,1145],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":87,"searchDepth":198,"depth":198,"links":1147},[1148,1149,1150,1151,1152,1153,1154,1155],{"id":31,"depth":198,"text":32},{"id":66,"depth":198,"text":67},{"id":177,"depth":198,"text":178},{"id":443,"depth":198,"text":444},{"id":594,"depth":198,"text":595},{"id":757,"depth":198,"text":758},{"id":908,"depth":198,"text":909},{"id":1068,"depth":198,"text":1069},"2026-03-22","Before doing anything with Docker, before writing a single Terraform file, before configuring a CI/CD pipeline, there is a layer on which everything runs.","md",{"slug":1160},"os-fundamentals","/blog/os-fundamentals",{"title":5,"description":1157},"blog/os-fundamentals",[1165,1166,86],"devops","linux","csu-7O9wL4voxbqLEOUKYbMr64asH6D14bfAkmHEGuc",1776137818685]