The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
1answer
42 views

How to get file owner in AIX without munging ls output?

How might I reliably get the owner of a file in AIX? By reliable, I don't want to parse the output of ls. On Linux, I would just do a stat --printf=%U foo, but I'm working on AIX 6.1 and 7.1. I ...
1
vote
2answers
36 views

Silent stat to check file existence

I'm running a command if a file is present in one line of bash. Here is what I'm doing for now: $ stat /last_dump.sql && mysql -D my_database < last_dump.sql Is it the right way to do ? ...
2
votes
3answers
54 views

Get file modification time in yyyymmddhh24miss format

I want to get the modification time of a file in a specific format. How can I do that ? I know about stat -c %x find.txt but I need this format: yyyymmddhh24miss I'm using ksh on Linux 2.6.18-...
0
votes
2answers
27 views

How does ext4 decide number of blocks of a file?

I'm playing with stat command which basically shows the inode information. Though I'm showing the information of a small file (146 characters), it shows 8 blocks. I was wondering why is that? Since ...
0
votes
1answer
35 views

Recursive Directory search, Showing most recent file in folder

Can someone point out where am going wrong please. Am doing a directory search (Based on the folder structure and file type) The folder structure is the same for every customer. Just the customer ...
5
votes
5answers
542 views

Is it possible to run ls or find and pipe it through stat?

Is there a way to run ls or find to get the list of files within a directory and then run stat to get all of the specific information (i.e. File Group, File Name, File Owner, File Size (displayed in K,...
0
votes
0answers
28 views

Internal fragmentation of a file

One of the exercises which I have to do is to show the appearance of internal fragmentation in a file system by calculating in bytes the size of stored space by a non-empty regular file, but not used ...
3
votes
1answer
69 views

How to list all inodes and blocks in file system which are available for unprivileged user

I'm trying to list all inodes and blocks in certain file system which are available and unused for unprivileged user. I tried stat -f but from what I've read it list nodes and block available for all ...
0
votes
0answers
34 views

why stat() can't get the real device number for ubifs

the man 2 stat struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t ...
0
votes
1answer
107 views

Can I get yesterday's stats using sar command but I have installed sar now

Can I get yesterday's stats using sar command, I have installed sar now so will I get yesterdays sa logs ? If yes then How ? I can see today's log : # sar -f /var/log/sa/sa12 Linux 3.14.19-17.43....
2
votes
1answer
88 views

`stat -f` show a ext4 file system type as ext2/ext3

On Ubuntu 14.04, I am checking the ext4 filesystem for my home based on a file new in it: $ stat -f new File: "new" ID: 38d4cd29e44142c6 Namelen: 255 Type: ext2/ext3 Block size: 4096 ...
1
vote
1answer
75 views

Do both “stat -f” and “cat /etc/fstab” show file system ids?

On Ubuntu 14.04, I am checking the filesystem for my home based on a file new in it: $ stat -f new File: "new" ID: 38d4cd29e44142c6 Namelen: 255 Type: ext2/ext3 Block size: 4096 ...
2
votes
0answers
30 views

Linux file creation time. What are the requirement challenges in considering useful atribute? [closed]

I find many users are acquiescent to the fact that many linux/unix variants do not support/store the file creation time. Yet, I feel it has some relevance in operations and audit & trail. I see ...
3
votes
2answers
89 views

Why `find` likes `stat` or `fstat` so much?

I'm trying to make /usr/bin/find to show something meaningful without doing any sort of stat, with no useful results so far. If I forcefully inhibit stat, find stops descending into subdirectories at ...
1
vote
3answers
74 views

How to list atime for files?

According to this post can stat be used to give the atime on Linux, but FreeBSD 10.1 doesn't have the GNU stat. How do I list the atime for files?
0
votes
0answers
25 views

Why is my stat command output different than examples online? [duplicate]

I've been reading about the stat command, and every example output I see has the file attributes organized by name. But when I run it through bash on my OSX system I get something like this: $ stat ...
1
vote
3answers
238 views

How to identify if a direcory is created by System or a root user?

How to identify if a directory is created by Linux system and by user like root. Example: in /etc there is a directory named sys which is created by Linux. And I logged in using root and created the ...
2
votes
1answer
122 views

What is the meaning of the mode mask names from stat(2) and chmod(2)?

The stat calls have a series of symbolic names for the various bits in the mode field. From the stat(2) manual page: The following mask values are defined for the file mode component of the st_mode ...
-1
votes
1answer
31 views

Stat with Python about line count of 2-bits [closed]

Pseudocode to get amount of lines for 2-bit system (2*30=60): python -c "from math import ceil; print ceil(`stat --printf="%s/30"`/500.0)"; but I would like to really run similar stat command ...
1
vote
2answers
127 views

Stat substitution command to capture numeric file permission in Solaris 10

There is no stat command in Solaris 10. Is there any way to get numeric file permission?
0
votes
1answer
32 views

Can I find the filesystem a file is going to be installed to? [duplicate]

I have a list of files along with their filepaths, that I'm planning to copy into a server. Is there a way, I could figure out before I copy, which filesystem it actually would go into? assuming the ...
1
vote
1answer
537 views

get original creation date of html file

Can I find the creation/last modified date of an html file? For example, I would like to know when some index.html file from some website was created, not when I downloaded it.
5
votes
1answer
144 views

stat file system sizes

With stat 8.13 on a Debian based Linux - among many others - the following FORMAT directives (--format=) are offered: In combination with --file-system (-f): %s Block size (for faster transfers) %...
4
votes
2answers
396 views

change file size format when using stat

The formatting character %s makes stat print the filesize in bytes # stat -c'%A %h %U %G %s %n' /bin/foo -rw-r--r-- 1 root root 45112 /bin/foo ls can be configured to print the byte size number ...
4
votes
5answers
866 views

How to cut a date/timestamp String?

So I am using TIMESTAMP=$( stat -c "%y" $JARNAME.jar ) print $TIMESTAMP and its output is something like 2015-04-24 17:23:03.000000000 -0500 I need only the 2015-04-24 17:23:03 part
3
votes
1answer
349 views

How can I see a file's historical modification times? [duplicate]

stat outputs a file's last modification time. How can I see a list of all the times a file was modified? For example, I'd like to edit a file 5 times, and see 5 modification times.
1
vote
1answer
257 views

cp: cannot stat error - when filename has Asian characters

I am simply trying to copy files using cp -r /home/user/source/ /home/user/destination/ but it throws me the cp: cannot stat /source/filename.xxx error for some of the files. When I searched for this ...
3
votes
2answers
223 views

get timestamp of files presented by FOR loop

My aim is to find $files on some $devices and save them to one or more folders which are namend corresponding to a timestamp of each file. To get the timestamp I wanted to use stat. In contrast to ...
3
votes
4answers
535 views

get file size and line count at the same time

I'm looking for a way to list all files in a directory, with both their size, and a line count. Right now I'm using stat -c \"%s %n\" /directory/* to get file names and sizes, and I know I can use ...
6
votes
1answer
1k views

stat: print time in “long-iso” format

For my script, I would like to have stat command to print time in a nice, human friendly, way: 2015-02-04 00:48:31. ls calls this format long-iso and it can be used like this: $ ls -lA --time-style=...
0
votes
0answers
16 views

Superuser can't `lstat` a directory but ordinary user can, what gives? [duplicate]

This really looks like a bug, and I'd like to dig in and find it, but I'm not sure where to start. First of all, I'm running Linux Mint, with a 3.13.0-24 x86_64 kernel. When I plug my Android tablet ...
1
vote
1answer
48 views

find's - cnewer broken on NTFS-3g?

After extracting an archive to the wrong place, I thought I'd erase everything created after it, but find . -cnewer archive.7z gave the wrong results. So I made a controlled test by touching three ...
2
votes
3answers
163 views

How to determine if a soft link's target is a directory or a file?

Given the ll command outputs as follows #> ll lrwxrwxrwx ... How to determine if a soft link's target is a directory or a file from "lrwxrwxrwx"?
1
vote
1answer
1k views

List files from time X to time Y

How to list out all files created between from 'x' to 'y' time? I want to list out files created between "29-dec-2014 18:00" to "30-dec-2014 18:00". Using ls or stat?
6
votes
3answers
6k views

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

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 ...
5
votes
1answer
55 views

How to find the number of bytes rewritten to a folder hierarchy? [duplicate]

I want metrics for how much writing and reading have been done to a folder. vmstat -d gives metrics at the whole disk level. iotop will give per process rw stats. But how can I find out how much ...
0
votes
2answers
93 views

How to save stat of all files found in a search?

I had a cron which removes all files with a specific pattern from temp. find /tmp/* -type f -iname magick-* -exec rm {} \; Now, I want to log the stat of all files before deleting them for future ...
1
vote
1answer
267 views

Why ls and stat shows different modified dates? [duplicate]

When I ls a file the last modified date shows as Nov 29 11:13, am but stat shows the file changed at Dec 3rd, why is the date different on ls and stat output. -rw-rr 1 iadm sys 266240 Nov 29 11:...
0
votes
1answer
210 views

Cannot stat error?

Running a "restore" script which moves a file previously deleted (moved to a trashbin folder) back to where it came from. Running the secondary script I receive this error... "mv: cannot stat `test': ...
5
votes
1answer
612 views

What does 'stat' mean in this sentence?

This sentence is from a Linux command's return,I can only thought it as 'statistics' but it is the noun form rather than the verb form. unable to stat ./config-2.6.32-431.el6.i686: No such file or ...
2
votes
1answer
51 views

Using `stat` to determine filled blocks

How can I find the number of filled block of a certain file, using the stat function? I have already found the command $(stat -c%b "$FILENAME"), which gives the number of allocated blocks but I don't ...
3
votes
1answer
1k views

Stat, Blocks and Sector size - ext4

While reading upon how files are stored in the filesystem, I created a testfile which happened to be of size 217 bytes. Checking the output of stat on this file, I saw that this file is occupying 8 ...
1
vote
1answer
713 views

Allow non-root user go get network traffic statistics

I know that I can use cat /sys/class/net/eth0/statistics/rx_bytes to see the amount of received bytes. Sadly I only can run this command as root. When I am another user, I get cat: /sys/class/net/...
1
vote
2answers
3k views

What does `process_usershare_file` do?

I have a samba server that is giving me this in logs for every single share (in this case "Public" is the share): Sep 2 07:49:42 MyServer smbd[31606]: [2014/09/02 07:49:42.398065, 0] param/loadparm....
1
vote
2answers
1k views

Check the filesystem format with BusyBox (stat -f and df -T do not work)

I am using latest BusyBox v1.22.1 in my target. I want to check the filesystem type using stat -f or df -T but busybox doesn't support such commands. busybox help shows stat command as supported but ...
-1
votes
1answer
146 views

Is %a an option of stat?

Usage: stat [OPTION]... FILE... Display file or file system status. -L, --dereference follow links -f, --file-system display file system status instead of file status -c --format=...
3
votes
1answer
214 views

Get device with major number 0 (btrfs subvolume)

When I stat a file on a btrfs subvolume I get a major device number of 0. Is there a reliable way to find the mount point of this device, without knowing in advance it is a btrfs subvolume? e.g. I'd ...
0
votes
1answer
1k views

What's the difference between modification date and inode's modification date?

I've just found some interesting information for me in man stat: a, m, c, B The time file was last accessed or modified, of when the inode was last changed, or the birth time of the inode. But what'...
1
vote
2answers
765 views

Find last edited date of file (strange exec behaviour)

I am trying to get the last modified dates of all the word documents in all the directories below this one $ pwd /run/user/1000/gvfs/smb-share:server=myServer,share=myResources If I do a regular ...