0
0
Linux CLIscripting~5 mins

Why Linux powers the internet in Linux CLI - Why It Works

Choose your learning style9 modes available
Introduction
Linux is the operating system that runs most of the internet's servers. It is reliable, secure, and free, which helps websites and services stay online and fast for everyone.
When you want a stable system to host websites that must run 24/7 without crashing
When you need a secure environment to protect user data on your online service
When you want to customize your server to run specific internet applications efficiently
When you want to save costs by using free and open-source software for your servers
When you want to use powerful tools and scripts to automate server management
Commands
This command shows the Linux system information, confirming the server runs Linux.
Terminal
uname -a
Expected OutputExpected
Linux my-server 5.15.0-60-generic #66-Ubuntu SMP Fri Feb 17 15:06:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
This command shows the current system resource usage, helping to monitor server health.
Terminal
top -b -n 1 | head -n 5
Expected OutputExpected
top - 10:00:00 up 10 days, 3:22, 1 user, load average: 0.00, 0.01, 0.05 Tasks: 120 total, 1 running, 119 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.0 us, 0.5 sy, 0.0 ni, 98.0 id, 0.5 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 2048000 total, 500000 free, 800000 used, 748000 buff/cache KiB Swap: 1024000 total, 1024000 free, 0 used. 900000 avail Mem
-b - Run top in batch mode for scripting
-n 1 - Show only one iteration of output
This command checks if the Nginx web server is running, which is common on Linux internet servers.
Terminal
ps aux | grep nginx
Expected OutputExpected
www-data 1234 0.0 0.1 123456 2345 ? Ss 09:59 0:00 nginx: master process /usr/sbin/nginx www-data 1235 0.0 0.2 123456 3456 ? S 09:59 0:00 nginx: worker process
This command shows disk space usage for the web server directory, important to keep websites running smoothly.
Terminal
df -h /var/www
Expected OutputExpected
Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 20G 28G 42% /var/www
-h - Show sizes in human-readable format
Key Concept

If you remember nothing else, remember: Linux is the backbone of internet servers because it is stable, secure, and flexible.

Common Mistakes
Trying to run internet services on unsupported or unstable operating systems
This can cause frequent crashes and downtime, making websites unreliable
Use Linux distributions known for stability and support, like Ubuntu Server or CentOS Stream
Ignoring system resource monitoring commands
Without monitoring, servers can run out of memory or CPU, causing slow or failed services
Regularly use commands like top and df to check server health and disk space
Not verifying if essential services like web servers are running
If the web server is down, websites become inaccessible to users
Use commands like ps aux | grep nginx to confirm services are active
Summary
Use uname -a to confirm the server runs Linux, the common OS for internet servers.
Monitor system health with top and disk space with df to keep services running smoothly.
Check that web servers like Nginx are running to ensure websites stay online.