Find the answer to your Linux question:
Results 1 to 2 of 2
Greetings, I am learning how to use Fedora8. My question was how do you find out with one command what port Apache or anything else is running on? Someone told ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    2

    Port Question

    Greetings,

    I am learning how to use Fedora8. My question was how do you find out with one command what port Apache or anything else is running on?

    Someone told me I can use:

    netstat -plant
    or
    lsof -i:80

    Maybe these are the right commands to use but not sure what to look for when I run them? I am sorry if I am asking for too much.

    Thank you in advance!!!!!

  2. #2
    Just Joined!
    Join Date
    Feb 2009
    Posts
    2
    Greetings again,

    I figured it out here is the output:

    netstat -plant
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:59205 0.0.0.0:* LISTEN 2332/rpc.statd
    tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2312/rpcbind
    tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2737/cupsd
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2593/sendmail: acce
    tcp 0 0 192.168.1.6:58627 65.55.249.68:80 ESTABLISHED 3209/firefox-bin
    tcp 0 0 192.168.1.6:33124 65.55.197.114:80 ESTABLISHED 3209/firefox-bin
    tcp 0 0 192.168.1.6:54698 65.55.174.199:80 ESTABLISHED 3209/firefox-bin
    tcp 0 0 192.168.1.6:33065 65.55.149.123:80 ESTABLISHED 3209/firefox-bin
    tcp 0 0 192.168.1.6:33143 65.55.197.114:80 ESTABLISHED 3209/firefox-bin
    tcp 1 0 192.168.1.6:56495 207.211.65.21:80 CLOSE_WAIT 9796/npviewer.bin
    tcp 0 0 :::80 :::* LISTEN 9640/httpd
    tcp 0 0 :::752 :::* LISTEN 2562/sshd
    tcp 0 0 :::23 :::* LISTEN 2572/xinetd


    And if you want to focus on just the httpd you will type this command:

    netstat -plant | grep httpd
    tcp 0 0 :::80 :::* LISTEN 9640/httpd

    So the port will be "80" as you see above. That will be the port that Apache is running on.
    Problem Solved!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...