cnetstat - a netstat like utility that supports color and searching
cnetstat [-t] [-u] [--drp] [-S <sort>] [-s <states>] [-c <CIDRs>] [-p <ports>] [-P <protocols>] [<-a>] [-l] [-i] [--nc] [<--ptr> <ptrs>] [--rptrs <regexs>] [--Si] [--si] [--ci] [--pi] [--Pi] [--ptri] [--rptri]
Show all connections, including those in the LISTEN state.
A comma seperated list of CIDRs to search for.
Invert the CIDR search.
Don't resolve port numbers to names.
Invert the sort.
Show connections in the LISTEN state. This is the equivalent of '-a -s listen'. If combined with -s, it will display LISTENing sockets and whatever is specified via -s.
Don't colorize the output. If The NO_COLOR environment variable is set, then it will it will also not be colorized and this flag will be inverted.
A comma seperated list of ports to search for.
Invert the port search.
A comma seperated list of PTRs to search for.
Invert the PTR search.
A comma seperated list of protocols to saerch for.
Invert the protocol search.
A comma seperated list of regular expressions to use for matching PTRs.
Invert the regex PTR search.
A comma seperated list of states to search for.
Invert the state ssearch.
The sort method to use. This is one of the supported methods by Parse::Netstat::Sort.
host_f Host, Foreign (default) host_l Host, Local port_f Port, Foriegn port_l Port, Local state State protocol Protocol q_r Queue, Receive q_s Queue, Send none No sorting is done.
The ones below are dual sort and take noticably longer than the ones above.
host_ff Host, Foreign First host_lf Host, Local First port_ff Port, Foreign First port_lf Port, Local First q_rf Queue, Receive First q_sf Queue, Send First
Don't fetch TCP info.
Don't fetch UDP info.
This is either 0 or 1. If defined it will be used for XORing the -i flag.
export CNETSTAT_invert=1 # run cnetstat inverted cnetstat # run it non-inverted, the opposite of what the -i flag normally is cnetstat -i
Sets the default sort method. -S overrides this.
If this is set, The output will not be colorized. If this is set, the --nc flag is also inverted.
A space-separated list of nameservers to query used by Net::DNS::Resolver.
There are a few more possible ones, but this is the most useful one and that documentation really belongs to that module.
cnestat -s established,time_wait
Return a list of connection that are in the established or time_wait state.
cnestat -c ::/0
Return a list of all IPv6 addresses.
cnestat -c ::1/128,127.0.0.1/32
Return all connections to localhost.
cnestat -c 192.168.15.2/32 -l
Display all connections listening explicitly on 192.168.15.2.
cnetstat -S host_f -i
Sort the connections by the foreign host and invert the results.
cnetstat -c 10.0.0.0/24 --ci
Show connections that are either not locally or remotely part of the 10.0.0.0/24 subnet.
cnetstat --ptr foo.bar
Find connections to/from IPs that have a PTR record of foo.bar.
cnetstat --rptr foo
Find connections to/from IPs that a PTR record that matches the regexp /foo/.
cnetstat --ptr foo.bar --ptri
Find connections to/from IPs that do not have a PTR record of foo.bar.
To install Parse::Netstat::Colorizer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Netstat::Colorizer
CPAN shell
perl -MCPAN -e shell install Parse::Netstat::Colorizer
For more information on module installation, please visit the detailed CPAN module installation guide.