How to use the stat command on OS X to display a file or directories creation date / time?
stat filename
What options to use with the f flag?
Answer: A: You can get the creation date & the last modified date in Finder using Get Info or selecting the file in column view or list view.
The stat command can also work against directories. In this case, we see that there are a number of links. Here, we're looking at a file system. Notice the Namelen (name length) field.
The stat is a command which gives information about the file and filesystem. Stat command gives information such as the size of the file, access permissions and the user ID and group ID, birth time access time of the file. Stat command has another feature, by which it can also provide the file system information.
stat command is a useful utility for viewing file or file system status.
This will give you the creation date, output it and convert the time to a more readable sequence :
stat -f %SB file/directory
Do note that Mac OS X keeps track of the creation time of a file/directory, whereas Linux doesn't since it isn't required by POSIX. You can find more information here
For more informations about the format you can use for the stat
command, go check the man page for stat(1) here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With