Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I installed CentOS on my laptop about 8 month ago, and I want to know when exactly I installed it , how can I do that in CentOS 6.4 ?

share|improve this question
    
This isn't really a duplicate. The dup it points to shows distro-agnostic ways only, this one includes those + distro specific ways to determine installation time. –  slm Feb 23 at 15:06
    
Related unix.stackexchange.com/questions/35566/… –  Braiam Feb 23 at 15:07
add comment

2 Answers

up vote 10 down vote accepted

tune2fs

You can use the command tune2fs to find out when the filesystem was created.

$ tune2fs -l /dev/main/partition |grep  'Filesystem created'

Example

$ sudo tune2fs -l /dev/dm-1 |grep  'Filesystem created'
Filesystem created:       Sat Dec  7 20:42:03 2013

which disk to use?

If you don't have /dev/dm-1 you can use the command blkid to determine your HDD topology.

$ blkid
/dev/sda1: UUID="XXXX" TYPE="ext4" 
/dev/sda2: UUID="XXXX" TYPE="LVM2_member" 
/dev/mapper/fedora_greeneggs-swap: UUID="XXXX" TYPE="swap" 
/dev/mapper/fedora_greeneggs-root: UUID="XXXX" TYPE="ext4" 
/dev/mapper/fedora_greeneggs-home: UUID="XXXX" TYPE="ext4" 

You can also find out what filesystem a directory is coming from using the df -h . command.

$ df -h .
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/fedora_greeneggs-root   50G  9.3G   38G  20% /

From kickstart .cfg file

You can also look at the date this file was created, assuming it wasn't deleted.

$ sudo  ls -lah ~root/anaconda-ks.cfg
-rw-------. 1 root root 1.3K Dec  7 21:10 /root/anaconda-ks.cfg

From RPM

Another method would be to find out when the package setup was installed. This package is rarely updated, only from version of version of distro, so it should be fairly safe to query it in this manner.

Example

$  rpm -qi setup | grep Install
Install Date: Sat 07 Dec 2013 08:46:32 PM EST

Another package that has similar qualities to setup is basesystem.

$ rpm -qi basesystem | grep Install
Install Date: Sat 07 Dec 2013 08:46:47 PM EST

Lastly you could just take the full list of installed packages and get the last few to see what their install dates were.

$ rpm -qa --last | tail 
nhn-nanum-fonts-common-3.020-8.fc19.noarch    Sat 07 Dec 2013 08:46:47 PM EST
basesystem-10.0-8.fc19.noarch                 Sat 07 Dec 2013 08:46:47 PM EST
m17n-db-1.6.4-2.fc19.noarch                   Sat 07 Dec 2013 08:46:46 PM EST
gnome-user-docs-3.8.2-1.fc19.noarch           Sat 07 Dec 2013 08:46:45 PM EST
foomatic-db-filesystem-4.0-38.20130604.fc19.noarch Sat 07 Dec 2013 08:46:45 PM EST
mozilla-filesystem-1.9-9.fc19.x86_64          Sat 07 Dec 2013 08:46:35 PM EST
dejavu-fonts-common-2.33-5.fc19.noarch        Sat 07 Dec 2013 08:46:34 PM EST
telepathy-filesystem-0.0.2-5.fc19.noarch      Sat 07 Dec 2013 08:46:33 PM EST
setup-2.8.71-1.fc19.noarch                    Sat 07 Dec 2013 08:46:32 PM EST
fontpackages-filesystem-1.44-7.fc19.noarch    Sat 07 Dec 2013 08:46:31 PM EST
share|improve this answer
    
there is no dm-1 file in my /dev directory –  Alireza Fallah 웃 Dec 30 '13 at 18:42
    
@AlirezaFallah - see updates. –  slm Dec 30 '13 at 18:44
    
actually the last two tip worked perfect, thanks –  Alireza Fallah 웃 Dec 30 '13 at 18:51
    
@AlirezaFallah - yeah I like to show all the method for Q's like this, b/c you never know a system's setup, it's always handy to have many options. –  slm Dec 30 '13 at 18:58
add comment

I assume during the installation you have formatted your file system?

If that's the case you can use the tune2fs utility to see the creation date that's stored in the super block of your root file system.

Assumed your root file system is /dev/sda3 you could do do this:

tune2fs -l /dev/sda3

In the output there should be a field called Filesystem created like here:

Filesystem created:       Wed Oct 31 15:30:21 2012
share|improve this answer
    
how can I find out the file system path ? there is sda and sda1 and sda2 in my /dev/ directory . –  Alireza Fallah 웃 Dec 30 '13 at 18:38
    
you can look at the output of the mount command. the one that is mounted to / is the root file system. –  mauro.stettler Dec 30 '13 at 18:45
add comment

Your Answer

 
discard

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.