0
0
Linux CLIscripting~15 mins

netstat and ss (connection listing) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Listing Network Connections with netstat and ss
📖 Scenario: You are a system administrator who needs to check active network connections on a Linux server. You want to list all current TCP connections and see which ports are listening for incoming connections.
🎯 Goal: Learn how to use netstat and ss commands to list active network connections and listening ports.
📋 What You'll Learn
Use netstat to list all TCP connections
Use ss to list all listening TCP ports
Filter output to show only established connections or listening ports
Display the final output clearly
💡 Why This Matters
🌍 Real World
System administrators often need to check active network connections to troubleshoot network issues or monitor server activity.
💼 Career
Knowing how to use <code>netstat</code> and <code>ss</code> is essential for Linux system administrators and network engineers.
Progress0 / 4 steps
1
List all TCP connections using netstat
Type the command netstat -tn to list all current TCP connections with numeric addresses.
Linux CLI
Need a hint?

The -t option shows TCP connections and -n shows numeric addresses.

2
List all listening TCP ports using ss
Type the command ss -lt to list all listening TCP ports.
Linux CLI
Need a hint?

The -l option shows listening sockets and -t limits to TCP.

3
Filter netstat output to show only established TCP connections
Type the command netstat -tn | grep ESTABLISHED to show only established TCP connections.
Linux CLI
Need a hint?

Use grep ESTABLISHED to filter connections in the ESTABLISHED state.

4
Display listening TCP ports with detailed info using ss
Type the command ss -ltp to list listening TCP ports with the process info.
Linux CLI
Need a hint?

The -p option shows the process using the socket.