0

There is a symlink linked_dir in dir, and I am trying to find when it was created. Within dir, I ran

stat -c %w useq_242_nyc

But the only output is

-

How can I check when this symlink was created?

  • 1
    Not all filesystems keep the creation time, or are configured to keep it. It looks like this inode doesn't have the creation time, but in the case of a symbolic link, I'd say it is highly likely that it was never modified after creation, so your best bet is stat -c %y. – berndbausch Jun 13 '23 at 00:45
  • I just found this page, which might offer a solution (I have not read it through very thoroughly, your mileage may vary): https://moiseevigor.github.io/software/2015/01/30/get-file-creation-time-on-linux-with-ext4/. – berndbausch Jun 13 '23 at 00:46
  • @berndbausch oh the %y option worked :) or at least it gave a datetime, which presumably is the creation time – anonuser01 Jun 13 '23 at 01:06
  • @anonuser01, it's likely as it's not really possible to modifiy a symlink, though one can use touch -hd 1999-02-01 symlink for instance on some systems to change the modification time arbitrarily. – Stéphane Chazelas Jun 13 '23 at 05:37
  • Well, %y shows you the time of last modification. In most symlink cases it is identical to the creation time, but see Stephane Chazelas' caveat. – berndbausch Jun 13 '23 at 11:01

0 Answers0