Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

5 Answers 5

up vote 5 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
1  
Or "ps aux | grep httpd" for redhat/centos. –  lg. Apr 13 '10 at 7:19
    
SvW = Sportverein Werder ? :D –  Ibrahim Apachi Aug 15 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

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.