Benutzer-Werkzeuge

Webseiten-Werkzeuge


freebsd:stat_freebsd

stat (FreeBSD)

Dateigröße in Byte ausgeben (ähnlich wie ls -l):

[root@FreeBSD14 ~]# stat -f '%z %N' /etc/rc.conf
5264 /etc/rc.conf
[root@FreeBSD14 ~]# ls -l /etc/rc.local
lrwxr-xr-x  1 root wheel 23 May 10  2022 /etc/rc.local -> /home/etc/rc.d/rc_local

[root@FreeBSD14 ~]# stat -f '%z %N %Y' /etc/rc.local
23 /etc/rc.local /home/etc/rc.d/rc_local

[root@FreeBSD14 ~]# stat -f '%z %N %Y' /home/etc/rc.d/rc_local
454 /home/etc/rc.d/rc_local
[root@FreeBSD14 ~]# stat -t '%Y-%m-%d %H:%M:%S' /etc/rc.conf
7169357729625349425 1941190 -rw-r--r-- 1 root wheel 18446744073709551615 5264 "2024-02-24 20:14:41" "2024-03-10 17:16:01" "2024-03-10 17:16:01" "2024-02-24 20:14:41" 5632 9 0x800 /etc/rc.conf
[root@FreeBSD14 ~]# stat -x /etc/rc.conf
  File: "/etc/rc.conf"
  Size: 5264         FileType: Regular File
  Mode: (0644/-rw-r--r--)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 1669245981,18446744072736800817   Inode: 1941190    Links: 1
Access: Sat Feb 24 20:14:41 2024
Modify: Sun Mar 10 17:16:01 2024
Change: Sun Mar 10 17:16:01 2024
 Birth: Sat Feb 24 20:14:41 2024
[root@FreeBSD14 ~]# stat -xt '%Y-%m-%d %H:%M:%S' /etc/rc.conf
  File: "/etc/rc.conf"
  Size: 5264         FileType: Regular File
  Mode: (0644/-rw-r--r--)         Uid: (    0/    root)  Gid: (    0/   wheel)
Device: 1669245981,18446744072736800817   Inode: 1941190    Links: 1
Access: 2024-02-24 20:14:41
Modify: 2024-03-10 17:16:01
Change: 2024-03-10 17:16:01
 Birth: 2024-02-24 20:14:41
[root@FreeBSD14 ~]# stat Test.webm
687931145 72687 -rw-r--r-- 1 quarzsnoopy dlna 18446744073709551615 42245351 "Apr 20 07:30:54 2024" "Apr 20 07:41:07 2024" "Apr 20 07:41:07 2024" "Apr 20 07:30:54 2024" 131072 82577 0x800 Test.webm

[root@FreeBSD14 ~]# stat -x Test.webm
  File: "Test.webm"
  Size: 42245351     FileType: Regular File
  Mode: (0644/-rw-r--r--)         Uid: ( 1009/quarzsnoopy)  Gid: (  933/    dlna)
Device: 255,687865865   Inode: 72687    Links: 1
Access: Sat Apr 20 07:30:54 2024
Modify: Sat Apr 20 07:41:07 2024
Change: Sat Apr 20 07:41:07 2024
 Birth: Sat Apr 20 07:30:54 2024

[root@FreeBSD14 ~]# stat -f "\"%Sc\" \"%SB\"" Test.webm
"Apr 20 07:41:07 2024" "Apr 20 07:30:54 2024"

[root@FreeBSD14 ~]# stat -t "%s" -f "%Sc %SB" Test.webm
1713591667 1713591054

so kann man sehen, wieviel Zeit zwischen Dateierstellung und der letzten Datenänderung in der Datei, vergangen ist (wie lange es gedauert hat, die Datei zu schreiben); hier sind es 613 Sekunden gewesen:

[root@FreeBSD14 ~]# stat -t "%s" -f "%Sc %SB" Test.webm | awk '{print $1 - $2}'
613
/home/http/wiki/data/pages/freebsd/stat_freebsd.txt · Zuletzt geändert: von manfred