[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Determining Available Ports on a Linux Machine

Posted on 2014-07-16
Medium Priority
Last Modified: 2014-07-16
I want to determine which ports are available on a Linux machine.  I assume there might be a command to do that?  If so what is it?
Question by:onaled777
  • 2
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40200336
Do you mean tcp ports above port 1000 that you can use to start a server on for example?

You can do this:

netstat -a | grep -i listen

This will show you the ports that are used (LISTENed) to. Other ports are available.

What is it you want to do?

Author Comment

ID: 40200409
I need to know if server ports are open and accessible. Is there a command that I can provide a port number to in order to determine if it is open? If not I will work with what you provided above.
LVL 38

Accepted Solution

Gerwin Jansen, EE MVE earned 2000 total points
ID: 40200560
You could use nc (netcat) for that, like this (checking port 9090):

nc -ul 9090

If you don't get the ... already in use ... message then the port is free.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question