2014-09-11 16:08:56 +05:30
|
|
|
# netstat
|
|
|
|
|
|
|
|
> Displays various networks related information such as open connections, open socket ports etc
|
|
|
|
|
2015-04-11 14:14:31 +02:00
|
|
|
- List all ports
|
2014-09-11 16:08:56 +05:30
|
|
|
|
|
|
|
`netstat -a`
|
|
|
|
|
2015-04-11 14:14:31 +02:00
|
|
|
- List all listening ports
|
2014-09-11 16:08:56 +05:30
|
|
|
|
|
|
|
`netstat -l`
|
|
|
|
|
2015-04-11 14:14:31 +02:00
|
|
|
- Display PID and program names
|
2014-09-11 16:08:56 +05:30
|
|
|
|
|
|
|
`netstat -p`
|
|
|
|
|
2015-04-11 14:14:31 +02:00
|
|
|
- Find out which port a process is running (e.g. find out which port ssh is listening on)
|
2014-09-11 16:08:56 +05:30
|
|
|
|
|
|
|
`netstat -ap | grep ssh`
|
|
|
|
|
2015-04-11 14:14:31 +02:00
|
|
|
- Find out which process is listening on a particular port
|
2014-09-11 16:08:56 +05:30
|
|
|
|
|
|
|
`netstat -ap | grep ':80'`
|