Questions tagged [stat]
The stat tag has no usage guidance.
189
questions
0
votes
1
answer
65
views
stat not giving birth datetime in cluster
with the command
stat file.txt I get
Access: 2024-06-10 14:55:36.254879000 +0300
Modify: 2024-06-10 14:55:36.254879000 +0300
Change: 2024-06-10 14:55:36.254879000 +0300
Birth: -
I work in a cluster ...
0
votes
0
answers
23
views
Debug log from system call stat() is not printed
I want to build the 4.18.1 linux kernel and add a debug log in several places: in clone and stat system calls. I added the line printk(KERN_INFO "syscallstat"); at https://elixir.bootlin.com/...
-1
votes
2
answers
113
views
Is this "stat [option]... inode number..." possible?
Is it possible to use stat for retrieving meta data of File1 by passing File1's inode number as an argument to stat instead of the file name?
stat [option - any doing this?] [inode number of File1]
...
1
vote
4
answers
613
views
Bash script - check if any files changed recently
I am writing a script which needs to check if any of the files in a given directory have been modified recently. I thought I could simply use find, however it reports success even if it doesn't find a ...
0
votes
1
answer
102
views
How to determine when KVM vm was created?
OS is Debian.
Not asking about uptime of course, but I would like to determine when vm was created and/or first booted.
Normally you can do something like: stat / and check birth time, but for a kvm ...
0
votes
1
answer
362
views
After `su user`, getting `fatal: failed to stat : Permission denied` with `git push`
There's a lot of setup for this question:
I've got a host (rpi5.local) with 2 user accounts: pi and cake.
I wanted to explore git, and I created the cake account to "own" the "server/...
0
votes
0
answers
24
views
In `find -exec`, using back quotes (backticks) with `stat` [duplicate]
I would like find to execute a different command depending on what the stats of a file are.
If I run the command
find . -name "*" -exec echo {} \+
then I get the list of files in the ...
-1
votes
1
answer
122
views
Bash - cannot stat the last file created in a for...do loop
In a bash script (on Ubuntu 22 if it matters) I have a function which, executed from within a for...do loop, is given a filename to execute some SQLplus <query_name>.sql and store the results in ...
0
votes
0
answers
105
views
Properly escape a string variable that contains special characters to be used in a shell script?
I feel dumb for asking such a simple question but Im absolutely stuck on this one. I've search everywhere, tried several methods to escape or properly quote this variable, but no matter what when I ...
0
votes
0
answers
38
views
How do I get the number of hardlinks of a folder?
I am on Mac. However, I use gstat (GNU stat) so my understanding is that behavior should match linux.
I cd to a folder. Then I use gstat --format=%h .. The output is 65.
Next, I use gfind . -maxdepth ...
3
votes
4
answers
394
views
Apply arithmetic into piped command
So far I have this:
sudo find /path/to/dir -type f |
xargs -d "\n" sudo stat -c "%Y %n" |
{arithmetic to check if %Y is between 1685518962 and 1685624474??} |
{show ...
1
vote
2
answers
126
views
how to list all files in a given period according their duration(not moment) of access
under linux, how to list all files
in a given directory and its subdirs,
in a given period, say last 10days,
according their duration of access, ideally the result ought to be sorted by access ...
0
votes
1
answer
344
views
How to get the most trusted and accurate linux distro stats?
I need the Linux distros usage statistics.
I need this data to make a more informed decision for our future technology choices.
However, I can't find the data. It seems that DistroWatch is a good ...
6
votes
2
answers
880
views
Why does wc and stat produce different results for /proc/[pid]/cmdline?
I am trying to understand why wc and stat report different things for /proc/[pid]/cmdline.
wc says my shell's cmdline file is 6 bytes in size:
$ wc --bytes /proc/$$/cmdline
6 /proc/10425/cmdline
stat ...
1
vote
2
answers
387
views
A script to show the age of a linux installation in days
I want to create a command that is called Age which calls this script:
From=$(stat / | grep "Birth" | sed 's/Birth: //g' | cut -b 2-11)
echo $From
Now=$(date)
echo $Now
However, I'm stuck ...