STATFS(1)

✨ STATFS ✨

okay bestie, so this is statfs(1), from the STATFS(1) manual β€” and it's giving "tiny tool, huge brain" energy fr fr. πŸ’…


πŸ’– NAME πŸ’–

statfs β€” dump the statfs(2) information for PATH to console in JSON format.

like. it dumps the statfs(2) info. to your console. in JSON. no cap. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

statfs PATH

one command, one path, that's the whole vibe. ⭐


🌸 DESCRIPTION 🌸

so the statfs(2) system call returns info about a mounted filesystem, and it hands it back inside a statfs_t structure. this tool dumps that info in JSON format. it's developed as part of gocryptfs and written in Go. πŸ¦‹

lowkey important: the statfs_t structure is architecture-dependent. on amd64 it looks like this:

type Statfs_t struct {
    Type   int64
    Bsize  int64
    Blocks uint64
    Bfree  uint64
    Bavail uint64
    Files  uint64
    Ffree  uint64
    Fsid   struct {
        Val [2]int32
    }
    Namelen int64
    Frsize  int64
    Flags   int64
    Spare   [4]int64
}

go read the statfs(2) man page for what all these fields actually mean, bestie. and heads up β€” the field names here are acc. to the Go golang.org/x/sys/unix naming convention, and they're slightly different than in C. iykyk πŸ’€


πŸ”₯ EXAMPLES πŸ”₯

get the statfs(2) information for /tmp:

$ statfs /tmp
{
    "Type": 16914836,
    "Bsize": 4096,
    "Blocks": 3067428,
    "Bfree": 3067411,
    "Bavail": 3067411,
    "Files": 3067428,
    "Ffree": 3067381,
    "Fsid": {
        "Val": [
            0,
            0
        ]
    },
    "Namelen": 255,
    "Frsize": 4096,
    "Flags": 38,
    "Spare": [
        0,
        0,
        0,
        0
    ]
}

look at that JSON. it ate and left absolutely no crumbs. πŸ‘‘


🧚 SEE ALSO 🧚


πŸ’œ AUTHORS πŸ’œ

github.com/rfjakob. periodt. πŸ™ˆ


Sep 2019 β€” STATFS(1) πŸ’– ok that's the whole page bestie, go forth and dump those filesystem stats, you absolute main character 🌈✨

πŸ“¦ where this page comes from