Questions tagged [stat]
181 questions
130
votes
8 answers
How can get the creation date of a file?
I want to find out the creation date of a particular file on a Linux system. Not the modification date or access date, the creation date.
I have tried with ls -ltrh and stat filename but neither gives me what I need. What else can I do to get this…
Özzesh
- 3,549
- 8
- 23
- 25
111
votes
6 answers
Birth is empty on ext4
I was just reading up on the Birth section of stat and it appears ext4 should support it, but even a file I just created leaves it empty.
~ % touch test slave-iv
~ % stat test.pl …
xenoterracide
- 57,918
- 74
- 184
- 250
66
votes
1 answer
What does this process STAT indicates?
If you check the STAT column in above image you will see Ss S S< SN and R+
What does this indicates ? Process states.
If yes,Then what is the significance of 'Ss S< SN and R+'?
Vishwanath Dalvi
- 4,346
- 5
- 20
- 17
38
votes
1 answer
What is a "weird file"?
An application I am using will not start with this user message: [Errno 13] Permission denied: '/home/sleblanc/.config/app/.config
When I used ls, the file showed up as such:
?--------- 1 root root 0 Dec 31 1969 .config
Running stat on the…
sleblanc
- 1,099
- 11
- 16
25
votes
2 answers
Output of stat on OSX
I want to use the stat command to get information on a file. I did this:
Josephs-MacBook-Pro:Desktop Joseph$ echo 'hello' > info.txt
Josephs-MacBook-Pro:Desktop Joseph$ stat info.txt
16777220 21195549 -rw-r--r-- 1 Joseph staff 0 6 "Dec 21 20:45:31…
jgleoj23
- 353
- 1
- 3
- 4
24
votes
3 answers
Is there still no Linux kernel interface to get file creation date?
For a long time, Linux hasn't bothered with file creation dates because none of the file systems it commonly used supported them. However now, 2 file systems commonly used (NTFS and ext4) both record file creation dates.
The stat command, however,…
Jez
- 948
- 3
- 15
- 33
19
votes
6 answers
Compare two file modification dates
I am creating a generic compilation/transpilation system. One way to know if a file has been compiled/transpiled already would be to compare the source and target file modification dates.
I need to write a bash script that can do…
Alexander Mills
- 9,330
- 19
- 95
- 180
17
votes
3 answers
stat: modification timestamp of a file
I use stat -f %m .bashrc to get modification time of my .bashrc on osx. But when I run the same command on ubuntu, it spits error:
stat: cannot read file system information for %m': No such file or directory
is there a compatible way to achieve…
del bao
- 303
- 1
- 2
- 4
14
votes
4 answers
How to inspect group permissions of a file
I would like to inspect group permissions of a file from a bash script. Specifically, I need to check whether a file has the group writeable bit on.
That's it. Simple as that. However:
I also need this to be portable.
test -w
mislav
- 381
- 1
- 3
- 10
13
votes
4 answers
Why do special device files have inodes?
Device files are not files per se. They're an I/O interface to use the devices in Unix-like operating systems. They use no space on disk, however, they still use an inode as reported by the stat command:
$ stat /dev/sda
File: /dev/sda
…
direprobs
- 944
- 14
- 29
13
votes
3 answers
file block size - difference between stat and ls
I've noticed that when I do a:
ls -ls file
It provides block count, say 8 blocks.
When I do:
stat file
I notice that the block count is 16, twice the number given by ls.
The block size on my file system is 4096. I learned that the arbitrary unit…
stantona
- 465
- 1
- 5
- 10
13
votes
4 answers
Determine if a file has been modified
In Linux (currently using ext4 filesystem), how can one check quickly if the contents of a file has been modified without reading any of its contents?
Is the stat command a recommended approach? I currently do
$ stat --format "%Y" hello.txt
and…
DustByte
- 553
- 1
- 7
- 14
12
votes
1 answer
Does inotify fire a notification when a write is started or when it is completed?
Imagine two processes, a reader and a writer, communicating via a regular file on an ext3 fs. Reader has an inotify IN_MODIFY watch on the file. Writer writes 1000 bytes to the file, in a single write() call. Reader gets the inotify event, and calls…
Todd Freed
- 243
- 2
- 7
12
votes
2 answers
When was `relatime` made the default?
What is the first Linux kernel release to set relatime as the default mount option?
bibop554
11
votes
5 answers
using stat to provide timestamp for touch
Am trying to OCR some documents insitu (from a linux command line on a windows share). The process of OCRing is find and I have muddled through using the find command to pipe the files through the loop correctly.
However I need to preserve the…
user17841