I want to know what access time is. I searched in the web but got the same definition:
read - gets changed
I know with touch
we can change it. Could anyone explain me more about it with an example how it is changed? And is there a way to get the creating date/time in unix?
Last access time
mknod(2)
,utimes(2)
andread(2)
system calls.Last modified time
mknod(2)
,utimes(2)
andwrite(2)
system calls.Last changed time
chmod(2)
,chown(2)
,link(2)
,mknod(2)
,rename(2)
,unlink(2)
,utimes(2)
andwrite(2)
system calls.the average time between a request for information stored in a particular component such as the hard derive or RAM and it's delivery. On the other word time between when a read request and when the desired word comes. For example 235,288 units/ 13,82 transactions = 16.8 units per transaction.
Contrary to an above answer, the creation or actually "birth" date is stored and can be accessed, see https://unix.stackexchange.com/a/50184/8250 (the debugfs should be done under sudo)
stat
structureThe
stat(2)
structure keeps track of all the file date/times:st_atime
is the access time, updated onread(2)
calls (and probably also whenopen(2)
opens a file for reading) — it is NOT updated when files are read viammap(2)
. (Which is why I assumeopen(2)
will mark the access time.)st_mtime
is the data modification time, either viawrite(2)
ortruncate(2)
oropen(2)
for writing. (Again, it is NOT updated when files are written viammap(2)
.)st_ctime
is the metadata modification time: when any of the other data in thestruct stat
gets modified.Changing timestamps
You can change the timestamps on files with
utime(2)
:Note you can only change the access time and (data) modification time. You can set either of these to arbitrary times, but the
ctime
is going to be set to the current time — because you changed the metadata for the file.stat
structure does not have create timeThere is no create time in this structure, so it's not possible to find out when a file was created directly from the system.
If you really need to know the create time, you can narrow it down to a range by looking at your backups — assuming the file you're interested in has been backed up, along with its metadata.
statx
structure does have create timeThe
statx(2)
syscall introduced a new structure that can report the creation time of a file. Not all filesystems support this feature.