Technology Sharing

netstat and ss commands

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

In Linux, netstat and ss are two commands used to display network connections, routing tables, interface statistics and other related information.

1.netstat command

Display network connections, routing tables, and statistics interfaces

netstat

-a: All active connections and listening ports

-t: TCP port

-u: UDP port

-l: Listening status socket

-n: Display port number

-r: Display routing table

Example: #netstat -tunp

2.ss command

ss

-a: All active connections and listening ports

-t: TCP port

-u: UDP port

-l: Listening status socket

-n: World display port number

-r: Display routing table

-o: Display timer information

-p: Display process information

Summarize:

ss provides features that netstat does not have, with more concise output and better performance