Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 9 down vote accepted

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

share|improve this answer
4  
Or "ps aux | grep httpd" for redhat/centos. – lg. Apr 13 '10 at 7:19
    
SvW = Sportverein Werder ? :D – Illvminated Aug 15 '14 at 10:20
netstat -anp | grep apache

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

share|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

If lsof is installed you could try something like this:

lsof | grep httpd

(for centos and friends)

lsof  | grep apache

(for debian and company)

share|improve this answer
netstat -tulpn

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

share|improve this answer

for freebsd sockstat | grep apache httpd

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.