Linux Fundamentals For DevOps: Linux core mechanism

Linux Fundamentals For DevOps: Linux core mechanism

posted Originally published at saeed.hashnode.dev 4 min read

Knowing where files live is only half the battle. To be an effective DevOps engineer, you need to know how Linux actually executes programs, manages their lifecycles, and secures them.
The crucial concepts you need to troubleshoot effectively.

The $PATH Variable

Linux does not search your entire hard drive when you type a command. It only checks a specific, prioritized list of folders. This list is saved in an environment variable called $PATH.

You download a new binary tool (like kubectl or terraform). You type its name in the terminal, but Linux replies with the dreaded command not found. To fix this, you must either move the binary into a folder that is already in your $PATH, or add your custom folder to the $PATH.

# Command: View the list of directories Linux currently checks for commands

echo $PATH

# Output Proof (Directories are separated by colons):
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Command: Add your custom scripts folder to the PATH for the current session

export PATH="/home/saeed/custom-scripts:$PATH"

How Binaries Work (Shared Libraries)

When you run a command like nginx or python, you are executing a binary file. In Linux, executables are typically formatted as ELF (Executable and Linkable Format) files. However, most binaries are not standalone; they rely on external pieces of code called shared libraries (.so files, similar to .dll files in Windows).

You compile a Go application or migrate a tool into a minimal Docker container (like Alpine Linux). When you run it, it crashes silently or throws a confusing no such file or directory error—even though you can see the binary sitting right there. Usually, the binary isn't missing; its required libraries are missing.

You can use the ldd command to print the shared libraries required by any program.

# Command: Verify exactly which shared libraries Nginx needs to run
ldd /usr/sbin/nginx

# Output Proof:
        linux-vdso.so.1 (0x00007ffe3b1f4000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f3a8b411000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f3a8b39c000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f3a8b2f6000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3a8b0cd000)

File Permission

Linux strict permissions dictate exactly who can Read, Write, or eXecute a file. This is often represented by numbers (like 777 or 644).

You are trying to connect to a cloud server via SSH using a private key (.pem file), but the connection is instantly rejected. If you set a .pem file to 777 (meaning everyone on the system can read, write, and execute it), SSH will intentionally reject it for being too exposed. Private keys must be set to 400—meaning absolutely no one except the owner is allowed to read it.

# Command: Attempting to SSH with a bad permission key
ssh -i my-key.pem ubuntu@10.0.0.5

# Output Proof:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for 'my-key.pem' are too open.

# Command: Secure the key so only the owner can read it (4), and no one can write (0) or execute (0)

chmod 400 my-key.pem

Processes and Signals

Every running program is a process assigned a unique Process ID (PID). The operating system communicates with and controls these processes using "Signals."

An application is hogging 100% of the CPU and needs to be stopped, or Kubernetes is trying to scale down a pod without dropping active user connections. You can send a SIGTERM (Signal 15), which politely asks the program to save its data and exit cleanly. Alternatively, a SIGKILL (Signal 9) forcefully terminates it at the hardware level, bypassing cleanup and potentially causing data corruption.

# Command: Find the Process ID of an application
pgrep -la nginx

# Output Proof:
1234 nginx: master process
1235 nginx: worker process

# Command: Politely ask the master process to shut down and clean up
kill -15 1234

File Descriptors

Remember concept , "Everything is a File"? That rule has a dark side.

Because Linux treats network connections as files, every time a user connects to your web server, the operating system opens a "File Descriptor" to track that connection. To protect itself from crashing, the Linux kernel sets strict limits on how many file descriptors a single process can open at once.

Your Nginx web server or Node.js application is suddenly dropping user connections during a high-traffic spike. You check the CPU and RAM, and both are perfectly fine. You check the Nginx error logs and see the dreaded worker_connections are not enough or Too many open files error. The operating system has forcibly stopped your app from accepting new traffic.

# Command: Show the maximum number of open file descriptors allowed for this user
ulimit -n

# Output Proof:
1024

# Command: Check how many file descriptors the entire system is currently using
cat /proc/sys/fs/file-nr

# Output Proof:
1205   0   9223372036854775807

Blog Summary

Understanding Linux goes beyond knowing where files live; it’s about understanding how the operating system executes code, secures data, and manages its own limits. This guide breaks down the invisible mechanics of Linux that every DevOps engineer must master to troubleshoot effectively.

You'll learn why binaries silently fail due to missing shared libraries, how to quickly fix "command not found" errors using the $PATH variable, and the strict permission rules required to secure SSH keys. We also cover how to safely manage and terminate running processes using signals, and finally, uncover the hidden trap of File Descriptors—explaining why servers suddenly drop connections with "Too many open files" errors and how to raise those limits.

More Posts

Linux Fundamentals for DevOps: Filesystem

Saeed - Apr 27

What Is an Availability Zone Explained Simply

Ijay - Feb 12

Why most people quit AWS

Ijay - Feb 3

Beyond the Terminal: My Hunt Through the Linux File System

codeXninjaDev - Apr 25

Learn Cloud Security Fundamentals in AWS for Beginners

Ijay - Dec 18, 2025
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!