Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-03-2012, 12:03 PM   #1
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
timestamp in files to 1901?

I thought that the timestamps of the files were Unix time stamps. But I found out that it's possible to set the timestamp of a file to 0
Dec 14  1901 b.txt
If the Unix time stamp starts at 1970-01-01, how it's possible to set the timestamp to 1901?

Note: before that it's impossible.
Old 11-03-2012, 12:58 PM   #2
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,469

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
The time stamp is a 32-bit signed number, which can represent times from Dec 13 20:45:52 UTC 1901 to Jan 19 03:14:07 UTC 2038. Jan 1 00:00:00 UTC 1970 is just the zero point.

Last edited by rknichols; 11-03-2012 at 01:00 PM.
1 members found this post helpful.
Old 11-03-2012, 01:05 PM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
If you are asking about the last modifide time i.e. timestamp of a file, as it's shown in 6th field of "ls -l" cmd, then it shows the time when file was last modified.
You can change it with whatever timestamp you want, as follow:
Let's say you've created a file b.txt
% ls -l b.txt
-rw-r--r-- 1 user user 0 Nov 3 00:12 b.txt
Then use "touch" cmd to change its timestamp:
% touch -mt 190112150012 b.txt
% ls -l b.txt
-rw-r--r-- 1 user user 0 Dec 15 1901 b.txt
Syntax: touch -mt [yyyymmddHHMM] [filename]

Last edited by shivaa; 11-03-2012 at 01:08 PM.
Old 11-03-2012, 07:00 PM   #4
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,107

Rep: Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478
and IF one is still using a 32 bit os on
"Jan 19 03:14:07 UTC 2038"

the Linux Y2K

"fun" and unknown odd things will happen .

fixed by using a 64 bit os

but by 2038 ???
the NEW 16 Qbit os .... and because we can not do this all day , for the next 20 min. ..........

Last edited by John VV; 11-03-2012 at 07:01 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Date timestamp from .gz files. liketheshell Linux - Newbie 2 09-25-2012 08:44 PM
[SOLVED] Need help sorting large number of files by timestamp and then greping those files scottjn Linux - Newbie 4 01-14-2011 10:42 AM
[SOLVED] Updating timestamp in files in directory tuxtutorials Programming 5 08-21-2010 09:03 AM
script to sort files according to timestamp aeby Linux - Newbie 1 05-16-2007 08:18 AM
Files being created with GMT timestamp Locura Slackware 0 12-07-2004 08:54 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration