Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [stat]

The tag has no usage guidance.

0
votes
1answer
40 views

Translating Linux stat(1) command into BSD stat(1) command

Background CLion's remote project feature currently doesn't support FreeBSD as a remote host OS, but I want to do some hacking and see if it works. By reading the log file, I think I have spotted (...
0
votes
0answers
28 views

permission denied: cdrom to change permission

I need to change the permission of cdrom. I have tried the command stat and this is the result: File: /media/cdrom0 Size: 2048 Blocks: 4 IO Block: 2048 directory Device: b00h/...
3
votes
1answer
93 views

Can bash read the “Date Added” of a file/directory?

With programs like stat you see access, modify and change, but with Finder on macOS there is a "Date Added" field. Can I get the "Date Added" for a file or directory displayed in the Terminal, like ...
0
votes
0answers
143 views

How do i capture /proc/<pid>/stat file of a process | linux kernel

As you may know, the /proc/stat file contain the numbers of ticks the different CPU's have spent their time. Same goes to /proc/pid/stat where the tics are measured based on pid (process id) But when ...
1
vote
2answers
32 views

modify time for extracted folder

I just (today is 31-jan-2019) downloaded some random source.tar.gz and extracted it. When I do stat on the resulting folder, I see: Access: 2019-01-31 10:37:26.308991485 +0100 Modify: 2018-11-18 00:...
6
votes
2answers
118 views

Why does GNU Core Utilities stat (including du and ls) report the following sizes (ext4 in GNU/Linux)?

If I have the following contents in a directory: empty_dir: Empty directory. empty_file: Empty file. one_char: File consisting of one character. several_blocks: File consisting of several blocks (but ...
0
votes
3answers
54 views

Using find to list directories that haven't been accessed since a certain date?

Using the stat command one can see and format the last date a directory was accessed. The adate Is it possible to use find to find the directories that were changed before a certain date using a ...
1
vote
1answer
151 views

How to use istat on AIX like stat on Linux distributions

In Linux, I use the following command to show this output: find /backup/$INSTANCE/tsm/* -exec echo '"{}" ' \; | xargs stat --printf "chown %U:%G '%n'\nchmod %a '%n'\n" >> /tmp/permissions.txt ...
6
votes
2answers
67 views

Is it normal that bash stat() and access() much, before commands?

Running strace on the bash shell that is instructed to run mkdir provided this output which shows lots of stats prior to execve the actual mkdir binary: BASH$> strace -f sh -c "bash -c \"mkdir /...
-3
votes
1answer
37 views

List files that are larger than 100 kB

I would like to list all the files in ~ whose size is greater than 100 kB but without using the find command. I need to do it with stat.
1
vote
1answer
54 views

Inode Timestamp Plus/Minus Interpretation

What does +0200 mean after the Access/Modify/Change timestamps? File: task-system.md Size: 197 Blocks: 24 IO Block: 4096 regular file Device: 33h/51d Inode: 14155787 Links: ...
1
vote
2answers
73 views

How can I use 'stat' to detect a new file and then move it to a different directory?

Ultimately I want to detect a new backup file being dropped into a directory and then move that new file to another location for other operations. This needs to work when there is nobody logged into ...
-1
votes
1answer
217 views

What can f_bsize be used for? (Is it similar to st_blksize?)

stat() on a file, returns several fields including st_blksize. This is documented as "the 'preferred' block size for efficient filesystem I/O". The value is not used as a unit for other stat() ...
-1
votes
1answer
43 views

Command-line Equivalent to MacOSX stat -f “%m%t%Sm %N” on Linux?

I need to extract the timestamp of when a file has been created modified for the first time. The files are on a server and can be accessed from MacOSX via sshfs, as well as from a Ubuntu server. Under ...
0
votes
1answer
177 views

mounted g_mass_storage doesn't delete files

I'm having a strange problem with g_mass_storage gadget where deleted files from the PC are not 'actually' being deleted, which causes further problems when indexing. Here is the procedure: mount ...
-1
votes
2answers
95 views

What does `stat -c '%B' *` mean? [duplicate]

stat -c '%B' * reports the same number 512 for each file. What does %B mean? I don't understand the manual: %B - The size in bytes of each block reported by ‘%b’ Is it related to my block size: $ ...
0
votes
1answer
57 views

How can I find the three largest files under a directory? [duplicate]

https://unix.stackexchange.com/a/240424/674 shows a way to find the three most recent changed files (directly or indirectly) under a directory. find . -type f -exec stat -c '%Y %n' {} \; | sort -nr | ...
0
votes
1answer
55 views

How can I separate information into fields in both input and output?

$ stat -c "%Y#%n#%y" * | awk -F'#' "BEGIN {OFS=\"|\"} NR==1,NR==3 {print \$2 \$3}" directory1/Blum2017-12-22 22:33:38.644178442 -0500 dir2/Ciolli2017-12-22 21:53:51.769368496 -0500 Dar2017-12-06 13:...
0
votes
1answer
85 views

df and stat -f difference in blocks count for ext4 filesystem on LVM

[yotsu@fedora ttyid:2 czw maj 10 19:25:32 ~]$ df -B4K /dev/mapper/fedora-home System plików 4K-bl użyte dostępne %uż. zamont. na /dev/mapper/fedora-home 625612 27690 561212 5% /home [...
0
votes
1answer
604 views

What is file block size in Linux?

I want to get file block size of two files, using stat struct. In internet, they say file block size is affected by which device is using. If that is right, does block size of all files in same ...
1
vote
1answer
41 views

What is th difference betwen stat -c %B and stat -c %o? [duplicate]

For academic purposes im trying to demonstrate internal fragmentation of a file. As i understand it, internal fragmentation can be shown as a difference between the size of file and the size of all ...
1
vote
1answer
198 views

Difference between blocks from filefrag and stat

I have created file named sometext with random data inside. I wanted to check metadata of this file using several programs. I have used filefrag and stat program. kd@kd-VPCEB2S1E ~/Downloads $ stat ...
0
votes
2answers
215 views

Using ls and stat [closed]

I have written this script, however the output is not correct. It returns stat cannot stat no such file or directory. The file format is Living Room-20180418-0955588134.jpg Any help will be ...
1
vote
1answer
49 views

The BSD's stat option equivalent to `%y` in GNU

There's an option %y which state the last modification time %y time of last data modification, human-readable BSD's stat could list verbose information as $ stat -x Foo File: "Foo" ...
38
votes
1answer
3k views

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
votes
2answers
75 views

A Sparse Format from command stat

I'd like to check the status my directories $ ls Foo Bar Zoo Check their status $ ls | xargs stat -x File: "Zoo" Size: 384 FileType: Directory Mode: (0755/...
7
votes
1answer
469 views

File name too long error with command 'stat'

I retrieve a booklist after seaching the python books in home directory using this command on OSX: find ~ -type f -iregex '.*python.*\.pdf' the booklist ... .../Computing/Python/...
-1
votes
2answers
283 views

ls -s uses wrong block size

Ubuntu linux: ls -s disagrees with du & stat for the number of blocks used by a small file. ls -s ../nc2/.git/logs/refs/heads/ total 4 du ../nc2/.git/logs/refs/heads/ 8 ../nc2/.git/logs/...
1
vote
2answers
64 views

Creation time anomaly

I need to know file creation time of a file. I tried to run stat filename command. But my fs does not stores file creation time as metadata. [root@s1 XYZ]# stat ./px/cd/78/...
5
votes
2answers
327 views

Meaning of statement that 'getcwd functions work correctly' in FreeBSD man page for mount_nullfs?

In FreeBSD, man mount_nullfs states that: The primary differences between a virtual copy of the file system and a symbolic link are that the getcwd(3) functions work correctly in the virtual ...
0
votes
1answer
61 views

Unable to stat itself when running a bash script

I have a bash script called a located in /home/agrillet/ where I do this command: BOOTSTRAP_MODIF="stat -c %Y '/home/agrillet/a'" The output is: ./a: line 60: stat -c %Y '/home/agrillet/a': No such ...
0
votes
0answers
125 views

Meaning of st_ino

This might be an easy question, but I can't seem to find the answer anywhere: what does the st_ino field of struct stat contain for filesystems that do not use inodes? I'm interested in particular in ...
1
vote
1answer
133 views

Why is the number of ticks inaccurate?

I checked the numbers in proc/stat to the the number of clock ticks the CPU has had and I saw that the sum of the numbers in CPU1-4 is not equal to the numbers written in front of CPU as a whole. Why ...
2
votes
1answer
82 views

stats does not work with spaces?

I am using a script to copy some files depending on the year they were created in, it works fine with files without spaces but with the files with spaces there is a problem with the stats command,for ...
3
votes
1answer
459 views

Understanding stat, du and ls -l output on my NFS mount

ls -l f.txt -rwxrwxr-x 1 abc abc 1161 Sep 1 02:02 f.txt stat f.txt File: `f.txt' Size: 1161 Blocks: 34 IO Block: 524288 regular file Device: 38h/56d Inode: 6448956669 Links: 1 ...
11
votes
4answers
2k views

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 ...
5
votes
3answers
4k views

List files with timestamp since epoch

I basically want to combine the output of find / with the output of: find / | xargs -L1 stat -c%Z The first command lists the files in the / directory and the second lists the timestamp of each ...
1
vote
1answer
101 views

What is “Device: 802h/2050d” stands for in inode?

When I list an inode with stat command: File: 'text' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 802h/2050d Inode: 8391119 Links: 1 Access: (0664/-rw-rw-...
5
votes
1answer
2k views

-bash: lstat: command not found

I'm using a Macbook Pro running El Capitan v 10.11.6. I am learning about symlinks, and in the man ln page, I found the following: A stat(2) on a symbolic link will return the linked-to file; an ...
5
votes
5answers
11k views

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 ...
1
vote
0answers
1k views

Why the difference between stat and df

I run these commands: df / stat -fc '%f * %s' / and get Filesystem 1K-blocks Used Available Use% Mounted on /dev/ma....Vol00 26409212 15604380 9441888 63% / and 2701196 * ...
1
vote
1answer
402 views

stat --format %N quotes

I used stat on two different versions of Ubuntu and it printed different types of quotes. 14.04 (coreutils 8.21-1ubuntu5.1): $ stat --format %N test.txt ‘test.txt’ 16.04 (coreutils 8.25-2ubuntu2): ...
0
votes
1answer
50 views

Track total data written in and read from a folder within bash script

I have a bash script to do calculation. This calculation generates big scratch files as big as 12 GB and the disk usage of scratch folder is ~30 GB. I want to know how much total data is written to ...
1
vote
2answers
72 views

How do I create a list of the file contents of a directory and sub-directories with creation, added, modified and last opened times for each file?

I have a Mac and need to create a list of all the file contents in a given directory and it's sub-directories, together with the 'Creation', 'Added', 'Modified' and 'Last Opened' dates for each file. ...
0
votes
1answer
151 views

Mtime timezone is different than ctime&atime, why?

I used the stat command on a certain file and i noticed mtime was in a different timezone than ctime and atime, what would cause such a thing and what is the reason that someone would do that? im ...
1
vote
2answers
661 views

How to include hidden files in stat command?

In my code I am basically looping recursively through all files and getting the sizes using stat -c%s $i. It works well for 99% of files, however, sometimes I get an error: stat: cannot stat '/media/...
1
vote
1answer
350 views

How to decode 6 digits file mode on AIX?

The file mode for a file on AIX returned by the Ruby stat method has 6 digits: ruby -e 'puts File::stat("testfile_upload-003").mode.to_s(8)' 100644 FWIW, Ruby version is ruby 2.1.6p336 (2015-04-13 ...
7
votes
3answers
6k views

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 ...
1
vote
1answer
285 views

Stat Symbolic Link : won't show original file modification time

Stat Symbolic Link stat file it only shows data on when the symbolic link was created. I was hoping to get data on when the origin had been modified.
6
votes
1answer
410 views

Why can touch change only all times, or nothing when not owner

We have a file foobar not owned by me, but it is in my group: $ ll total 4,0K -rw-rw-r-- 1 root hbogert 4 jan 19 12:27 foobar I can touch it and it will update all times: $ stat foobar File: '...