Solaris Einzeiler: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
No edit summary |
m (Text replacement - "[[Kategorie:" to "[[Category:") |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Solaris|Einzeiler]] | |||
=== netstat -aun oder lsof -i -P -n unter Solaris 10 === | === netstat -aun oder lsof -i -P -n unter Solaris 10 === | ||
< | <syntaxhighlight lang=bash> | ||
#!/bin/bash | #!/bin/bash | ||
pfiles /proc/* 2>/dev/null | nawk -v port=$1 ' | pfiles /proc/* 2>/dev/null | nawk -v port=$1 ' | ||
Line 17: | Line 19: | ||
printf(" %s:%s/%s\n",$3,$5,type); | printf(" %s:%s/%s\n",$3,$5,type); | ||
}' | }' | ||
</ | </syntaxhighlight> |
Latest revision as of 04:52, 26 November 2021
netstat -aun oder lsof -i -P -n unter Solaris 10
#!/bin/bash
pfiles /proc/* 2>/dev/null | nawk -v port=$1 '
/^[0-9]/ {
pid=$1; cmd=$2; type="unknown"; next;
}
$1 == "SOCK_STREAM" {
type="tcp"; next;
}
$1 == "SOCK_DGRAM" {
type="udp"; next;
}
$2 ~ /AF_INET?/ && ( port=="" || $5==port ) {
if($2 ~ /[0-9]$/ && type !~ /[0-9]$/) type=type""substr($2,8);
if(cmd!="") { printf("%d %s\n",pid,cmd); cmd="" }
printf(" %s:%s/%s\n",$3,$5,type);
}'