This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:sysadmin [2018/07/24 16:56] mstraub [/etc/crontab] |
linux:sysadmin [2020/08/20 11:59] (current) mstraub [Check Open Ports & Connections] |
||
---|---|---|---|
Line 677: | Line 677: | ||
<code bash> | <code bash> | ||
netstat -a # print open & listening internet connections and Unix domain sockets | netstat -a # print open & listening internet connections and Unix domain sockets | ||
- | netstat -a -t # print only tcp connections (-u for udp) | + | netstat -a -t -p # print only tcp connections (-u for udp) and the associated pid |
netstat -s # print statistics about e.g. nr of received packets | netstat -s # print statistics about e.g. nr of received packets | ||
netstat -r # print the kernel routing table | netstat -r # print the kernel routing table | ||
Line 686: | Line 686: | ||
nmap localhost # print open ports on current machine (only a selection of common ports) | nmap localhost # print open ports on current machine (only a selection of common ports) | ||
nmap -p 1-9999 host # print open ports on a host (with a defined port range) | nmap -p 1-9999 host # print open ports on a host (with a defined port range) | ||
+ | nmap -Pn -p 1-9999 host # as above, but skip host discovery (helpful if above probe fails) | ||
nmap -A -T4 host # print open ports with enabled version detection (-A) and don't wait too long (-T4) | nmap -A -T4 host # print open ports with enabled version detection (-A) and don't wait too long (-T4) | ||
</code> | </code> |