Determining Available Ports on a Linux Machine

Posted on 2014-07-16
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
    LVL 37

    Expert Comment

    by:Gerwin Jansen
    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

    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 37

    Accepted Solution

    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

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now