Fedora – find the source code for `uptime`

fedorasourceuptime

I am learning Python. Till now I've been doing only basic Python coding. A day ago, I checked python implementation of tree command. Suddenly I thought of creating a Python clone for uptime. I don't have any clue about which language it is implemented in and what would be the complexity involved in cloning it.

But I couldn't find its source code. I am using Fedora 14. kernel-devel package is installed. I did whereis uptime but the resulting /usr/bin/uptime file shows weird symbols when opened using vim. Googling for its source code couldn't yield desired results either. Where can I find its source code?

Best Answer

Uptime is part of the 'procps' package, the upstream source is at http://procps.sourceforge.net/ (Not a fedora user, so not sure where to find their .src.rpm).

To answer the question you didn't ask, however; take a look in /proc/uptime The first number is seconds since boot. You should be able to turn that into something usable fairly easily :)

Related Question