how to use netstat on a specific port in Linux
Guys i want to know if my specific port is running a server using netstat? how do i achieve that?
linux networking netstat
migrated from stackoverflow.com May 31 '13 at 9:27
This question came from our site for professional and enthusiast programmers.
add a comment |
Guys i want to know if my specific port is running a server using netstat? how do i achieve that?
linux networking netstat
migrated from stackoverflow.com May 31 '13 at 9:27
This question came from our site for professional and enthusiast programmers.
1
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47
add a comment |
Guys i want to know if my specific port is running a server using netstat? how do i achieve that?
linux networking netstat
Guys i want to know if my specific port is running a server using netstat? how do i achieve that?
linux networking netstat
linux networking netstat
asked May 31 '13 at 5:37
Monkey
migrated from stackoverflow.com May 31 '13 at 9:27
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com May 31 '13 at 9:27
This question came from our site for professional and enthusiast programmers.
1
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47
add a comment |
1
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47
1
1
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47
add a comment |
3 Answers
3
active
oldest
votes
You can use
netstat -pnlt | grep ':portno'
another option , you can use nmap tool for checking open ports on the server
nmap -sT -O localhost
Output
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
Device type: general purpose
Netstat Example :
[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 1164/httpd
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
add a comment |
use netstat -anp | grep portNumber
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
add a comment |
I think netstat -nat | grep port | grep LISTEN
should do the trick.
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with-l
instead of-a
. And the question was not only about tcp ports so the-t
option shouldn't be there.
– Paul Tobias
Mar 24 '16 at 8:17
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f602049%2fhow-to-use-netstat-on-a-specific-port-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use
netstat -pnlt | grep ':portno'
another option , you can use nmap tool for checking open ports on the server
nmap -sT -O localhost
Output
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
Device type: general purpose
Netstat Example :
[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 1164/httpd
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
add a comment |
You can use
netstat -pnlt | grep ':portno'
another option , you can use nmap tool for checking open ports on the server
nmap -sT -O localhost
Output
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
Device type: general purpose
Netstat Example :
[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 1164/httpd
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
add a comment |
You can use
netstat -pnlt | grep ':portno'
another option , you can use nmap tool for checking open ports on the server
nmap -sT -O localhost
Output
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
Device type: general purpose
Netstat Example :
[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 1164/httpd
You can use
netstat -pnlt | grep ':portno'
another option , you can use nmap tool for checking open ports on the server
nmap -sT -O localhost
Output
Starting nmap 3.55 ( http://www.insecure.org/nmap/ ) at 2004-09-24 13:49 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
Device type: general purpose
Netstat Example :
[root@krizna ~]# netstat -pnlt | grep ':80'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::80 :::* LISTEN 1164/httpd
answered May 31 '13 at 7:47
kriznakrizna
33114
33114
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
add a comment |
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
and what part there in the results i can determine if it is a server?
– Monkey
May 31 '13 at 7:50
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
Check the netstat example part, port :::80 is shown under local address which is LISTENING ( i mean open ).
– krizna
May 31 '13 at 8:14
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
It is worth mentioning that the grep ':portno' may also pick up some IPv6 addresses that happen to contain that sequence. That can be a problem if you try to use this command in a script.
– Kevin Keane
Aug 27 '18 at 18:54
add a comment |
use netstat -anp | grep portNumber
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
add a comment |
use netstat -anp | grep portNumber
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
add a comment |
use netstat -anp | grep portNumber
use netstat -anp | grep portNumber
answered May 31 '13 at 5:54
ragsrags
1215
1215
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
add a comment |
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
so im getting list of many port 80 connections. how do i find the server port?
– Monkey
May 31 '13 at 6:10
add a comment |
I think netstat -nat | grep port | grep LISTEN
should do the trick.
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with-l
instead of-a
. And the question was not only about tcp ports so the-t
option shouldn't be there.
– Paul Tobias
Mar 24 '16 at 8:17
add a comment |
I think netstat -nat | grep port | grep LISTEN
should do the trick.
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with-l
instead of-a
. And the question was not only about tcp ports so the-t
option shouldn't be there.
– Paul Tobias
Mar 24 '16 at 8:17
add a comment |
I think netstat -nat | grep port | grep LISTEN
should do the trick.
I think netstat -nat | grep port | grep LISTEN
should do the trick.
answered May 31 '13 at 6:54
wizard
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with-l
instead of-a
. And the question was not only about tcp ports so the-t
option shouldn't be there.
– Paul Tobias
Mar 24 '16 at 8:17
add a comment |
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with-l
instead of-a
. And the question was not only about tcp ports so the-t
option shouldn't be there.
– Paul Tobias
Mar 24 '16 at 8:17
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with
-l
instead of -a
. And the question was not only about tcp ports so the -t
option shouldn't be there.– Paul Tobias
Mar 24 '16 at 8:17
This is listing all ports, and then grep for listening ports. Instead it should just show the listening ports with
-l
instead of -a
. And the question was not only about tcp ports so the -t
option shouldn't be there.– Paul Tobias
Mar 24 '16 at 8:17
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f602049%2fhow-to-use-netstat-on-a-specific-port-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
netstat -anp | grep portNumber
– rags
May 31 '13 at 5:47