Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

This question already has an answer here:

When we use uptime, it only shown us the up-time of ours machine since it started from the last time it turning on/shutdown/reboot.

But, what if I want to get the time when our machine started from the very first time when it installed?

Do Linux own this tools? Or any clues about how I can find out the answer of it?

share|improve this question

marked as duplicate by kce, Dave M, squillman, Magellan, Falcon Momot Oct 24 '13 at 3:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Which distribution? Some potential answers to this question may be distribution-specific. – Michael Hampton Sep 30 '13 at 2:37
@Michael: I'm using Debian server ... – yan Sep 30 '13 at 2:38
You say "machine" but the answers seem to assume "installation". (Case in point, when I built my current PC and physically reinstalled the old hard disk with the old system still on it in the new case, the new machine essentially had an accumulated power-on time of 0 hours, but the installed system had been running for a long time already. Even this isn't completely accurate as I kept the same power supply that I had been using before...) – Michael Kjörling Sep 30 '13 at 7:52
up vote 11 down vote accepted

If you're on a distribution that uses Anaconda, you can look at /root/install.log.

edit: It appears you're using Debian. Debian places its install log into /var/log/installer.

share|improve this answer
Thank you MDMarra ... using your answer and to find out the oldest file in it then I use command ls -gt | tail -l ... – yan Sep 30 '13 at 2:45

One of my favorite distribution-agnostic tricks is to check the inode change time of files or directories which are extremely unlikely to ever have been altered over the life of the server. These are generally directories in the root directory, such as /lost+found.

For example, this Ubuntu 10.04 LTS system was indeed installed around 9:40 pm on February 1, 2011.

# ls -lctr / | head -n 5
total 88
drwxr-xr-x   2 root root  4096 2011-02-01 21:40 selinux
drwxr-xr-x   2 root root  4096 2011-02-01 21:40 opt
drwxr-xr-x   2 root root  4096 2011-02-01 21:40 mnt
drwxr-xr-x   2 root root  4096 2011-02-01 21:40 media

And finally, a sure fire answer which is reasonably sure to be accurate, if you have an ext* root filesystem. Look at the filesystem metadata, which contains the time the filesystem was created. For instance, this command shows the creation time for the filesystem mounted at /.

tune2fs -l $(grep " / " /proc/mounts | grep -v rootfs | cut -f 1 -d " ") | grep created
share|improve this answer
You are right Michael, it have the same value with timestamp of /var/log/installer, the answer that has answered by MdMara ... TYVM. – yan Sep 30 '13 at 2:53

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