0
0
Linux CLIscripting~5 mins

netstat and ss (connection listing) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the netstat command do in Linux?
The netstat command shows network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
Click to reveal answer
intermediate
What is the main difference between netstat and ss commands?
ss is a newer, faster tool that shows socket statistics and network connections, while netstat is older and slower but still widely used.
Click to reveal answer
beginner
How do you list all listening TCP ports using ss?
Use ss -lt to list all listening TCP ports.
Click to reveal answer
beginner
What option with netstat shows all connections including listening and non-listening?
The option -a with netstat shows all connections, both listening and non-listening.
Click to reveal answer
intermediate
Why might you prefer ss over netstat on modern Linux systems?
ss is faster, uses less CPU, and provides more detailed socket information, making it better for quick and detailed network diagnostics.
Click to reveal answer
Which command shows all listening UDP connections using ss?
Anetstat -lt
Bss -lt
Cnetstat -au
Dss -lu
What does the -n option do in netstat or ss?
AShows only established connections
BShows network statistics summary
CShows numeric addresses and ports instead of resolving names
DShows only listening sockets
Which command lists all TCP connections including listening and established using netstat?
Ass -au
Bnetstat -at
Css -at
Dnetstat -au
What is the purpose of the -p option in ss or netstat?
AShow the process using the socket
BShow protocol statistics
CShow only passive sockets
DShow port numbers only
Which command is generally faster and recommended for modern Linux systems?
Ass
Bnetstat
Cifconfig
Dping
Explain how to use ss to find all listening TCP ports and the processes using them.
Think about options to show listening sockets and process details.
You got /5 concepts.
    Describe the differences and advantages of using ss over netstat for connection listing.
    Consider performance and information richness.
    You got /4 concepts.