script to verify running services on specific ports

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I got a task to do.
I have to search whether, are there running services on below ports.
ports 53 & 55
If not I have to send alerts.
Please correct my logic and syntax in below code for one port
ntstat=`netstat -tulpn | grep :53 | grep LISTEN | awk 'print $4'`
port="*:53"
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]];
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Output :
127.0.1.1:53
*:53
Port is not listing
I am struggling to match strings (127.0.1.1:53 to *:53)
shell-script regular-expression string netstat
add a comment |Â
up vote
2
down vote
favorite
I got a task to do.
I have to search whether, are there running services on below ports.
ports 53 & 55
If not I have to send alerts.
Please correct my logic and syntax in below code for one port
ntstat=`netstat -tulpn | grep :53 | grep LISTEN | awk 'print $4'`
port="*:53"
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]];
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Output :
127.0.1.1:53
*:53
Port is not listing
I am struggling to match strings (127.0.1.1:53 to *:53)
shell-script regular-expression string netstat
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
You've got some answers from people on Linux systems. I'm not on Linux and mynetstatis different. Could you not also check the daemons that are supposed to listen on those ports? Somesystemctlcommand or other to make sure they are running? (again, I'm not on Linux)
â Kusalananda
Oct 10 '17 at 21:26
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I got a task to do.
I have to search whether, are there running services on below ports.
ports 53 & 55
If not I have to send alerts.
Please correct my logic and syntax in below code for one port
ntstat=`netstat -tulpn | grep :53 | grep LISTEN | awk 'print $4'`
port="*:53"
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]];
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Output :
127.0.1.1:53
*:53
Port is not listing
I am struggling to match strings (127.0.1.1:53 to *:53)
shell-script regular-expression string netstat
I got a task to do.
I have to search whether, are there running services on below ports.
ports 53 & 55
If not I have to send alerts.
Please correct my logic and syntax in below code for one port
ntstat=`netstat -tulpn | grep :53 | grep LISTEN | awk 'print $4'`
port="*:53"
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]];
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Output :
127.0.1.1:53
*:53
Port is not listing
I am struggling to match strings (127.0.1.1:53 to *:53)
shell-script regular-expression string netstat
shell-script regular-expression string netstat
edited Oct 10 '17 at 17:25
Thomas
3,62141124
3,62141124
asked Oct 10 '17 at 17:15
Prabash
226
226
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
You've got some answers from people on Linux systems. I'm not on Linux and mynetstatis different. Could you not also check the daemons that are supposed to listen on those ports? Somesystemctlcommand or other to make sure they are running? (again, I'm not on Linux)
â Kusalananda
Oct 10 '17 at 21:26
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37
add a comment |Â
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
You've got some answers from people on Linux systems. I'm not on Linux and mynetstatis different. Could you not also check the daemons that are supposed to listen on those ports? Somesystemctlcommand or other to make sure they are running? (again, I'm not on Linux)
â Kusalananda
Oct 10 '17 at 21:26
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
You've got some answers from people on Linux systems. I'm not on Linux and my
netstat is different. Could you not also check the daemons that are supposed to listen on those ports? Some systemctl command or other to make sure they are running? (again, I'm not on Linux)â Kusalananda
Oct 10 '17 at 21:26
You've got some answers from people on Linux systems. I'm not on Linux and my
netstat is different. Could you not also check the daemons that are supposed to listen on those ports? Some systemctl command or other to make sure they are running? (again, I'm not on Linux)â Kusalananda
Oct 10 '17 at 21:26
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
0
down vote
accepted
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g'
#!/bin/bash
ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk 'print $4' | sed -e 's/.*:/:/g'`
port=":53 "
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]]
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Please note that I added a space right after the port number in order to avoid other ports containing 53
Since this are bash operators, you must want to put the shebang #!/bin/bash at the very top of your script so when you execute your script as ./portlisten.sh, it will take the interpreter as /bin/bash, would be the same if you execute your script as $ bash portlisten.sh
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
add a comment |Â
up vote
1
down vote
To check if there are running services on ports 53(or 55) I would suggest the following optimized solution:
port=":53"
if netstat -tulpn | grep --line-buffered -q "$port .*LISTEN"; then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
add a comment |Â
up vote
0
down vote
Don't use netstat since this is a deprecated command, use ss instead.
In your case you could use something like:
ss -H -o state listening '( sport = :53 or sport = :55 )'
1
Who deprecatednetstat? How can a non-standard utility be deprecated?
â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda thenetstatcommand is part of thenet-toolsbundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at theman netstatmanpage. Once again,netstatis replaced byss (Socket Statistics), has a more sophisticated option set and is the future.
â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linuxnetstatmay well be old, butnetstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.
â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations usesockstatin that regard. Also as far as my research concerns, The man page ofnetstattells us the following:NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.
â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-toolsnetstatmay be deprecated, but the BSD version certainly is not: man.openbsd.org/netstat
â Kusalananda
Oct 11 '17 at 9:24
 |Â
show 3 more comments
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g'
#!/bin/bash
ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk 'print $4' | sed -e 's/.*:/:/g'`
port=":53 "
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]]
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Please note that I added a space right after the port number in order to avoid other ports containing 53
Since this are bash operators, you must want to put the shebang #!/bin/bash at the very top of your script so when you execute your script as ./portlisten.sh, it will take the interpreter as /bin/bash, would be the same if you execute your script as $ bash portlisten.sh
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
add a comment |Â
up vote
0
down vote
accepted
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g'
#!/bin/bash
ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk 'print $4' | sed -e 's/.*:/:/g'`
port=":53 "
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]]
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Please note that I added a space right after the port number in order to avoid other ports containing 53
Since this are bash operators, you must want to put the shebang #!/bin/bash at the very top of your script so when you execute your script as ./portlisten.sh, it will take the interpreter as /bin/bash, would be the same if you execute your script as $ bash portlisten.sh
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g'
#!/bin/bash
ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk 'print $4' | sed -e 's/.*:/:/g'`
port=":53 "
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]]
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Please note that I added a space right after the port number in order to avoid other ports containing 53
Since this are bash operators, you must want to put the shebang #!/bin/bash at the very top of your script so when you execute your script as ./portlisten.sh, it will take the interpreter as /bin/bash, would be the same if you execute your script as $ bash portlisten.sh
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g'
#!/bin/bash
ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk 'print $4' | sed -e 's/.*:/:/g'`
port=":53 "
#Just to echo for testing
echo $ntstat
echo $port
if [[ "$ntstat" == "$port" ]]
then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
Please note that I added a space right after the port number in order to avoid other ports containing 53
Since this are bash operators, you must want to put the shebang #!/bin/bash at the very top of your script so when you execute your script as ./portlisten.sh, it will take the interpreter as /bin/bash, would be the same if you execute your script as $ bash portlisten.sh
edited Oct 11 '17 at 13:43
answered Oct 10 '17 at 18:29
tachomi
3,47431134
3,47431134
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
add a comment |Â
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
Thanks lot for your solution . Can please explan how does sed -e 's/.*:/:/g' command works with my output 127.0.1.1:53.since i am very new to sed commands .
â Prabash
Oct 11 '17 at 0:43
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
I have implemented your code. but still i am getting this out put - :53 :53 portlisten.sh: 10: portlisten.sh: [[: not found Port is not listing
â Prabash
Oct 11 '17 at 3:04
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
@Prabash I edited the answer, give a try
â tachomi
Oct 11 '17 at 13:43
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
so i added your new code and execute as ./portlisten.sh please find output as below :53 :53 Port is not listing still it says "port is not listing" , I think we have problem with string matching
â Prabash
Oct 12 '17 at 5:59
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
I am able to below get out put :53 :53 X Service at port number :53 #I have removed " " in variables comparison ..... if [[ $ntstat == $port ]] . Once again thank for your support.
â Prabash
Oct 12 '17 at 7:34
add a comment |Â
up vote
1
down vote
To check if there are running services on ports 53(or 55) I would suggest the following optimized solution:
port=":53"
if netstat -tulpn | grep --line-buffered -q "$port .*LISTEN"; then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
add a comment |Â
up vote
1
down vote
To check if there are running services on ports 53(or 55) I would suggest the following optimized solution:
port=":53"
if netstat -tulpn | grep --line-buffered -q "$port .*LISTEN"; then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
add a comment |Â
up vote
1
down vote
up vote
1
down vote
To check if there are running services on ports 53(or 55) I would suggest the following optimized solution:
port=":53"
if netstat -tulpn | grep --line-buffered -q "$port .*LISTEN"; then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
To check if there are running services on ports 53(or 55) I would suggest the following optimized solution:
port=":53"
if netstat -tulpn | grep --line-buffered -q "$port .*LISTEN"; then
echo " X Service at port number $port"
else
echo " Port is not listing "
fi
answered Oct 10 '17 at 17:42
RomanPerekhrest
22.5k12145
22.5k12145
add a comment |Â
add a comment |Â
up vote
0
down vote
Don't use netstat since this is a deprecated command, use ss instead.
In your case you could use something like:
ss -H -o state listening '( sport = :53 or sport = :55 )'
1
Who deprecatednetstat? How can a non-standard utility be deprecated?
â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda thenetstatcommand is part of thenet-toolsbundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at theman netstatmanpage. Once again,netstatis replaced byss (Socket Statistics), has a more sophisticated option set and is the future.
â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linuxnetstatmay well be old, butnetstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.
â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations usesockstatin that regard. Also as far as my research concerns, The man page ofnetstattells us the following:NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.
â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-toolsnetstatmay be deprecated, but the BSD version certainly is not: man.openbsd.org/netstat
â Kusalananda
Oct 11 '17 at 9:24
 |Â
show 3 more comments
up vote
0
down vote
Don't use netstat since this is a deprecated command, use ss instead.
In your case you could use something like:
ss -H -o state listening '( sport = :53 or sport = :55 )'
1
Who deprecatednetstat? How can a non-standard utility be deprecated?
â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda thenetstatcommand is part of thenet-toolsbundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at theman netstatmanpage. Once again,netstatis replaced byss (Socket Statistics), has a more sophisticated option set and is the future.
â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linuxnetstatmay well be old, butnetstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.
â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations usesockstatin that regard. Also as far as my research concerns, The man page ofnetstattells us the following:NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.
â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-toolsnetstatmay be deprecated, but the BSD version certainly is not: man.openbsd.org/netstat
â Kusalananda
Oct 11 '17 at 9:24
 |Â
show 3 more comments
up vote
0
down vote
up vote
0
down vote
Don't use netstat since this is a deprecated command, use ss instead.
In your case you could use something like:
ss -H -o state listening '( sport = :53 or sport = :55 )'
Don't use netstat since this is a deprecated command, use ss instead.
In your case you could use something like:
ss -H -o state listening '( sport = :53 or sport = :55 )'
answered Oct 10 '17 at 21:13
Valentin B
5,51611527
5,51611527
1
Who deprecatednetstat? How can a non-standard utility be deprecated?
â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda thenetstatcommand is part of thenet-toolsbundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at theman netstatmanpage. Once again,netstatis replaced byss (Socket Statistics), has a more sophisticated option set and is the future.
â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linuxnetstatmay well be old, butnetstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.
â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations usesockstatin that regard. Also as far as my research concerns, The man page ofnetstattells us the following:NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.
â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-toolsnetstatmay be deprecated, but the BSD version certainly is not: man.openbsd.org/netstat
â Kusalananda
Oct 11 '17 at 9:24
 |Â
show 3 more comments
1
Who deprecatednetstat? How can a non-standard utility be deprecated?
â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda thenetstatcommand is part of thenet-toolsbundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at theman netstatmanpage. Once again,netstatis replaced byss (Socket Statistics), has a more sophisticated option set and is the future.
â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linuxnetstatmay well be old, butnetstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.
â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations usesockstatin that regard. Also as far as my research concerns, The man page ofnetstattells us the following:NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.
â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-toolsnetstatmay be deprecated, but the BSD version certainly is not: man.openbsd.org/netstat
â Kusalananda
Oct 11 '17 at 9:24
1
1
Who deprecated
netstat? How can a non-standard utility be deprecated?â Kusalananda
Oct 11 '17 at 6:07
Who deprecated
netstat? How can a non-standard utility be deprecated?â Kusalananda
Oct 11 '17 at 6:07
@Kusalananda the
netstat command is part of the net-tools bundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at the man netstat manpage. Once again, netstat is replaced by ss (Socket Statistics) , has a more sophisticated option set and is the future.â Valentin B
Oct 11 '17 at 9:17
@Kusalananda the
netstat command is part of the net-tools bundle which hasn't been maintained since 2011. To me this is pretty much outdated and shouldn't be used in modern operating systems. Have a loop at the man netstat manpage. Once again, netstat is replaced by ss (Socket Statistics) , has a more sophisticated option set and is the future.â Valentin B
Oct 11 '17 at 9:17
@val0x00ff Ah, the Linux
netstat may well be old, but netstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.â Kusalananda
Oct 11 '17 at 9:19
@val0x00ff Ah, the Linux
netstat may well be old, but netstat, albeit another implementation of it, is also installed by default on BSDs. This is obviously not "deprecated" but actively maintained.â Kusalananda
Oct 11 '17 at 9:19
@Kusalananda BSD implementations use
sockstat in that regard. Also as far as my research concerns, The man page of netstat tells us the following: NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.â Valentin B
Oct 11 '17 at 9:22
@Kusalananda BSD implementations use
sockstat in that regard. Also as far as my research concerns, The man page of netstat tells us the following: NOTES This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netâ stat -i is ip -s link. Replacement for netstat -g is ip maddr.â Valentin B
Oct 11 '17 at 9:22
@val0x00ff I'm ok with saying that the net-tools
netstat may be deprecated, but the BSD version certainly is not: man.openbsd.org/netstatâ Kusalananda
Oct 11 '17 at 9:24
@val0x00ff I'm ok with saying that the net-tools
netstat may be deprecated, but the BSD version certainly is not: man.openbsd.org/netstatâ Kusalananda
Oct 11 '17 at 9:24
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397271%2fscript-to-verify-running-services-on-specific-ports%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
@Kusalananda please look into this
â Prabash
Oct 10 '17 at 17:28
You've got some answers from people on Linux systems. I'm not on Linux and my
netstatis different. Could you not also check the daemons that are supposed to listen on those ports? Somesystemctlcommand or other to make sure they are running? (again, I'm not on Linux)â Kusalananda
Oct 10 '17 at 21:26
Thanks . No worries
â Prabash
Oct 11 '17 at 0:37