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

I am looking for a method / Linux command to get the up-time of the open-ssh server and Nginx server running on my Ubuntu system. I want to know the up-time for calculating some internal statistics. I am looking for something similar to mysqladmin status command.


share|improve this question
You probably want this:… – Jonathan Ben-Avraham Apr 17 '13 at 20:00
up vote 6 down vote accepted

Well there isn't really an uptime of openssh. you can check that it is active or how many connections it has. Or can grab the last time it was restarted by looking at /var/run/

ls -l /var/run/
-rw-r--r-- 1 root root 4 2012-12-15 21:26 /var/run/

That file is updated when the daemon starts/restarts. So you can calculate based on that.

For nginx you can install the status module ( and then use that to get some information, but alas uptime doesn't look to be there. Could probably use the same idea of looking at the nginx pid files, but that will just tell you since the last restart etc. and not 100% indicative of uptime.

share|improve this answer

Check the following answer for getting that information from ps.

You'll need to parse that output (awk, Perl, or Python come to mind).

Alternatively you might be able to use the ctime of (for example)


but I'm not 100% sure about that.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.