0
0
Linux CLIscripting~15 mins

Why Linux powers the internet in Linux CLI - See It in Action

Choose your learning style9 modes available
Why Linux Powers the Internet
📖 Scenario: You are a system administrator learning why Linux is the backbone of the internet. You will explore simple Linux commands and concepts that show Linux's power and flexibility in managing internet services.
🎯 Goal: Build a small script that lists active network connections, filters those related to internet services, and counts them. This will help you understand how Linux manages internet traffic.
📋 What You'll Learn
Use the ss command to list network connections
Create a variable called connections to store the output of ss -tuln
Create a variable called internet_connections to filter lines containing :80 or :443
Count the number of internet connections and store it in count
Print the count with a descriptive message
💡 Why This Matters
🌍 Real World
System administrators use Linux commands and scripts like this to monitor and manage internet services on servers.
💼 Career
Understanding Linux networking commands is essential for roles in IT support, network administration, and cybersecurity.
Progress0 / 4 steps
1
List all active network connections
Create a variable called connections and assign it the output of the command ss -tuln using command substitution.
Linux CLI
Need a hint?

Use $(command) to capture command output into a variable.

2
Filter internet service connections
Create a variable called internet_connections that filters connections to include only lines containing :80 or :443 using grep.
Linux CLI
Need a hint?

Use grep -E ':80|:443' to match either port 80 or 443.

3
Count the filtered internet connections
Create a variable called count that counts the number of lines in internet_connections using wc -l.
Linux CLI
Need a hint?

Use wc -l to count lines.

4
Display the count of internet connections
Print the message "Number of active internet connections: " followed by the value of count using echo.
Linux CLI
Need a hint?

Use echo "Number of active internet connections: $count" to print the message.

The actual number may vary; for validation, zero is acceptable if no connections exist.