20

Is there any command to find out if apache is running or not.

and on which port except by seeingports.conf files

When i try netstat command then apaches does not appear in that.

but when i use apache2 restart command then it says restart ok

i don't know where it is running

19

lsof -i list open ports and the corresponding applications.

For a general check if an app is running you could just use ps aux | grep apache2

| improve this answer | |
  • 7
    Or "ps aux | grep httpd" for redhat/centos. – lg. Apr 13 '10 at 7:19
21
netstat -anp | grep apache

You could see the listening port and PID from this if it's running.

| improve this answer | |
  • sudo netstat -anp | grep apache – Laukik Patel Feb 26 '15 at 5:43
  • It's showing 0.0.0.0:80 in the "Local Address" column. Does it mean apache is running at the same ip address of the machine, on port 80? – Rodrigo Sep 30 '15 at 14:33
3
netstat -tulpn

You'll see the Pid / Binary name on far right column, match this to your running apache instance.

| improve this answer | |
3

If lsof is installed you could try something like this:

lsof | grep httpd

(for centos and friends)

lsof  | grep apache

(for debian and company)

| improve this answer | |
0

for freebsd sockstat | grep apache httpd

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy