Linux notes

Revision as of 14:17, 11 September 2012 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

stat: Change versus Modify

The stat command and system call returns metadata about a file or directory. It can return four different times related to a file. The distinction between the times can be confusing. The Modify and Change times cause the most confusion (I always have to look up the difference when I need to use them).

the time the file was created. This is not always available. It depends on the filesystem. The ext4 filesystem has it (see crtime), ext3 does not have it.
the time the file was last read. This is not always reliable. It may be available, but depending on how your filesystem is mounted this time may never be updated (if mounted with noatime option).
the time the contents of the file was modified (written to).
the time the meta data of the file was changed (permissions, ownership, or even 'Modify' time).

The Modify time is the time most people think about when working with files. By default the ls command shows the Modify time, but it can optionally show the other times.


Thie conspy lets you connect to the virtual consoles. These are the text consoles you see when Linux boots before X or xdm is started. These are the getty processes that you see in the process list.

To exit hit Esc key three times in quick succession. Hit Ctrl-L to refresh the screen if it gets out of sync.

This will show the tty1 default boot console:

conspy 1