{"id":30170063,"url":"https://github.com/alexdreptu/sysinfo","last_synced_at":"2025-08-11T20:49:27.888Z","repository":{"id":57501744,"uuid":"70322645","full_name":"alexdreptu/sysinfo","owner":"alexdreptu","description":"A Go module to get minimal system information on Linux","archived":false,"fork":false,"pushed_at":"2023-02-25T07:22:13.000Z","size":104,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T01:54:52.759Z","etag":null,"topics":["archey","archlinux","linux","sysinfo"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexdreptu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-08T10:07:40.000Z","updated_at":"2022-12-20T10:00:09.000Z","dependencies_parsed_at":"2024-06-20T01:29:33.632Z","dependency_job_id":"a2117f84-fc5c-4e59-b21c-ce40ebf84ce3","html_url":"https://github.com/alexdreptu/sysinfo","commit_stats":null,"previous_names":["alectic/sysinfo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexdreptu/sysinfo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdreptu%2Fsysinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdreptu%2Fsysinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdreptu%2Fsysinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdreptu%2Fsysinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdreptu","download_url":"https://codeload.github.com/alexdreptu/sysinfo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdreptu%2Fsysinfo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269955894,"owners_count":24503095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archey","archlinux","linux","sysinfo"],"created_at":"2025-08-11T20:49:27.014Z","updated_at":"2025-08-11T20:49:27.836Z","avatar_url":"https://github.com/alexdreptu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/alexdreptu/sysinfo/workflows/Build/badge.svg)](https://github.com/alexdreptu/sysinfo/actions)\n[![Coverage Status](https://coveralls.io/repos/github/alexdreptu/sysinfo/badge.svg?branch=master\u0026kill_cache=1)](https://coveralls.io/github/alexdreptu/sysinfo?branch=master)\n[![GoDev](https://pkg.go.dev/badge/github.com/alexdreptu/sysinfo)](https://pkg.go.dev/github.com/alexdreptu/sysinfo)\n[![Platform](https://img.shields.io/badge/platform-Linux-5272b4.svg)](https://www.linuxfoundation.org/)\n[![License](https://img.shields.io/badge/license-MIT-5272b4.svg)](https://github.com/alexdreptu/sysinfo/blob/master/LICENSE)\n\n#### This module is not meant to be a complete solution, rather it's meant to get just the minimum system information required by [archey-go](https://github.com/alexdreptu/archey-go). If you're looking for something more complete, then you might want to take a look at [gopsutil](https://github.com/shirou/gopsutil)\n\n### Examples\n\n#### CPU Info\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/cpu\"\n)\n```\n\n```Go\ncpu := \u0026cpu.CPU{}\nif err := cpu.Fetch(); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\nor\n\n```Go\ncpu, err := cpu.New()\nif err != nil {\n    fmt.Printf(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\n```Go\nfmt.Printf(\"Name: %s\\n\", cpu.Name)\nfmt.Printf(\"Model: %d\\n\", cpu.Model)\nfmt.Printf(\"Vendor: %s\\n\", cpu.Vendor)\nfmt.Printf(\"Family: %d\\n\", cpu.Family)\nfmt.Printf(\"Stepping: %d\\n\", cpu.Stepping)\nfmt.Printf(\"Cores: %d\\n\", cpu.Cores)\nfmt.Printf(\"Cache Size: %d KiB\\n\", cpu.CacheSize)\nfmt.Printf(\"Cache Size: %.2f MiB\\n\", cpu.CacheSizeInMebibytes())\nfmt.Printf(\"Min Frequency: %d KHz\\n\", cpu.MinFreq)\nfmt.Printf(\"Max Frequency: %d KHz\\n\", cpu.MaxFreq)\nfmt.Printf(\"Min Frequency: %.2f MHz\\n\", cpu.MinFreqInMegahertz())\nfmt.Printf(\"Min Frequency: %.1f GHz\\n\", cpu.MinFreqInGigahertz())\nfmt.Printf(\"Max Frequency: %.2f MHz\\n\", cpu.MaxFreqInMegahertz())\nfmt.Printf(\"Max Frequency: %.1f GHz\\n\", cpu.MaxFreqInGigahertz())\nfmt.Printf(\"Flags %s\\n\", cpu.FlagsAsString())\n```\n\n#### Filesystem Info\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/fs\"\n)\n```\n\n```Go\nrootfs := \u0026fs.FS{Path: \"/\"}\nif err := rootfs.Fetch(); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\nor\n\n```Go\nrootfs, err := fs.New(\"/\")\nif err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\n```Go\nfmt.Printf(\"Total Space on Root: %.2f KiB\\n\", rootfs.TotalSpaceInKibibytes())\nfmt.Printf(\"Total Space on Root: %.2f MiB\\n\", rootfs.TotalSpaceInMebibytes())\nfmt.Printf(\"Total Space on Root: %.2f GiB\\n\", rootfs.TotalSpaceInGibibytes())\n\nfmt.Printf(\"Free Space on Root: %.2f KiB\\n\", rootfs.FreeSpaceInKibibytes())\nfmt.Printf(\"Free Space on Root: %.2f MiB\\n\", rootfs.FreeSpaceInMebibytes())\nfmt.Printf(\"Free Space on Root: %.2f GiB\\n\", rootfs.FreeSpaceInGibibytes())\n\nfmt.Printf(\"Used Space on Root: %.2f KiB\\n\", rootfs.UsedSpaceInKibibytes())\nfmt.Printf(\"Used Space on Root: %.2f MiB\\n\", rootfs.UsedSpaceInMebibytes())\nfmt.Printf(\"Used Space On Root: %.2f GiB\\n\", rootfs.UsedSpaceInGibibytes())\n```\n\n#### Memory Info\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/mem\"\n)\n```\n\n```Go\nmem := \u0026mem.Mem{}\nif err := mem.Fetch(); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\nor\n\n```Go\nmem, err := mem.New()\nif err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\n```Go\nfmt.Printf(\"Total Mem: %.2f KiB\\n\", mem.TotalMemInKibibytes())\nfmt.Printf(\"Total Mem: %.2f MiB\\n\", mem.TotalMemInMebibytes())\nfmt.Printf(\"Total Mem: %.2f GiB\\n\", mem.TotalMemInGibibytes())\n\nfmt.Printf(\"Total High Mem: %.2f KiB\\n\", mem.TotalHighMemInKibibytes())\nfmt.Printf(\"Total High Mem: %.2f MiB\\n\", mem.TotalHighMemInMebibytes())\nfmt.Printf(\"Total High Mem: %.2f GiB\\n\", mem.TotalHighMemInGibibytes())\n\nfmt.Printf(\"Free Mem: %.2f KiB\\n\", mem.FreeMemInKibibytes())\nfmt.Printf(\"Free Mem: %.2f MiB\\n\", mem.FreeMemInMebibytes())\nfmt.Printf(\"Free Mem: %.2f GiB\\n\", mem.FreeMemInGibibytes())\n\nfmt.Printf(\"Free High Mem: %.2f KiB\\n\", mem.FreeHighMemInKibibytes())\nfmt.Printf(\"Free High Mem: %.2f MiB\\n\", mem.FreeHighMemInMebibytes())\nfmt.Printf(\"Free High Mem: %.2f GiB\\n\", mem.FreeHighMemInGibibytes())\n\nfmt.Printf(\"Avail Mem: %.2f KiB\\n\", mem.AvailMemInKibibytes())\nfmt.Printf(\"Avail Mem: %.2f MiB\\n\", mem.AvailMemInMebibytes())\nfmt.Printf(\"Avail Mem: %.2f GiB\\n\", mem.AvailMemInGibibytes())\n\nfmt.Printf(\"Used Mem: %.2f KiB\\n\", mem.UsedMemInKibibytes())\nfmt.Printf(\"Used Mem: %.2f MiB\\n\", mem.UsedMemInMebibytes())\nfmt.Printf(\"Used Mem: %.2f GiB\\n\", mem.UsedMemInGibibytes())\n\nfmt.Printf(\"Total Used Mem: %.2f KiB\\n\", mem.TotalUsedMemInKibibytes())\nfmt.Printf(\"Total Used Mem: %.2f MiB\\n\", mem.TotalUsedMemInMebibytes())\nfmt.Printf(\"Total Used Mem: %.2f GiB\\n\", mem.TotalUsedMemInGibibytes())\n\nfmt.Printf(\"Total Used: %.2f KiB\\n\", mem.TotalUsedInKibibytes())\nfmt.Printf(\"Total Used: %.2f MiB\\n\", mem.TotalUsedInMebibytes())\nfmt.Printf(\"Total Used: %.2f GiB\\n\", mem.TotalUsedInGibibytes())\n\nfmt.Printf(\"Buffer Mem: %.2f KiB\\n\", mem.BufferMemInKibibytes())\nfmt.Printf(\"Buffer Mem: %.2f MiB\\n\", mem.BufferMemInMebibytes())\nfmt.Printf(\"Buffer Mem: %.2f GiB\\n\", mem.BufferMemInGibibytes())\n\nfmt.Printf(\"Shared Mem: %.2f KiB\\n\", mem.SharedMemInKibibytes())\nfmt.Printf(\"Shared Mem: %.2f MiB\\n\", mem.SharedMemInMebibytes())\nfmt.Printf(\"Shared Mem: %.2f GiB\\n\", mem.SharedMemInGibibytes())\n\nfmt.Printf(\"Total Swap: %.2f KiB\\n\", mem.TotalSwapInKibibytes())\nfmt.Printf(\"Total Swap: %.2f MiB\\n\", mem.TotalSwapInMebibytes())\nfmt.Printf(\"Total Swap: %.2f GiB\\n\", mem.TotalSwapInGibibytes())\n\nfmt.Printf(\"Free Swap: %.2f KiB\\n\", mem.FreeSwapInKibibytes())\nfmt.Printf(\"Free Swap: %.2f MiB\\n\", mem.FreeSwapInMebibytes())\nfmt.Printf(\"Free Swap: %.2f GiB\\n\", mem.FreeSwapInGibibytes())\n\nfmt.Printf(\"Used Swap: %.2f KiB\\n\", mem.UsedSwapInKibibytes())\nfmt.Printf(\"Used Swap: %.2f MiB\\n\", mem.UsedSwapInMebibytes())\nfmt.Printf(\"Used Swap: %.2f GiB\\n\", mem.UsedSwapInGibibytes())\n```\n\n#### Node Info\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/node\"\n)\n```\n\n```Go\nnode := \u0026node.Node{}\nif err := node.Fetch(); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\nor\n\n```Go\nnode, err := node.New()\nif err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\n```Go\nfmt.Printf(\"Domainname: %s\\n\", node.DomainName)\nfmt.Printf(\"Machine: %s\\n\", node.Machine)\nfmt.Printf(\"Nodename: %s\\n\", node.NodeName)\nfmt.Printf(\"OS Name: %s\\n\", node.OSName)\nfmt.Printf(\"Release: %s\\n\", node.Release)\nfmt.Printf(\"Sysname: %s\\n\", node.SysName)\nfmt.Printf(\"Version: %s\\n\", node.Version)\n```\n\n#### Uptime Info\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/uptime\"\n)\n```\n\n```Go\nuptime := \u0026uptime.Uptime{}\nif err := uptime.Fetch(); err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n}\n```\n\nor\n\n```Go\nuptime, err := uptime.New()\nif err != nil {\n    fmt.Fprintln(os.Stderr, err)\n    os.Exit(1)\n)\n```\n\n```Go\nfmt.Printf(\"Uptime: %s\\n\", uptime)\nfmt.Printf(\"Up since (RFC1123): %s\\n\", uptime.Since())\nfmt.Printf(\"Up since (Custom): %s\\n\", uptime.SinceFormat(\"%d/%m/%y %T\")) // strftime format\n```\n\n#### Convert units\n\n```Go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/alexdreptu/sysinfo/convert\"\n)\n\nfunc main() {\n     // convert bytes\n    bytes := 8267812044.8\n    fmt.Printf(\"%.2f Bytes -\u003e %.2f Kibibytes\\n\",\n        bytes, (convert.Size(bytes) * convert.Byte).ToKibibytes())\n    fmt.Printf(\"%.2f Bytes -\u003e %.2f Mebibytes\\n\",\n        bytes, (convert.Size(bytes) * convert.Byte).ToMebibytes())\n    fmt.Printf(\"%.2f Bytes -\u003e %.2f Gibibytes\\n\",\n        bytes, (convert.Size(bytes) * convert.Byte).ToGibibytes())\n\n    // convert kibibytes\n    kibibytes := 8074035.2\n    fmt.Printf(\"%.2f Kibibytes -\u003e %.2f Bytes\\n\",\n        kibibytes, (convert.Size(kibibytes) * convert.Kibibyte).ToBytes())\n    fmt.Printf(\"%.2f Kibibytes -\u003e %.2f Mebibytes\\n\",\n        kibibytes, (convert.Size(kibibytes) * convert.Kibibyte).ToMebibytes())\n    fmt.Printf(\"%.2f Kibibytes -\u003e %.2f Gibibytes\\n\",\n        kibibytes, (convert.Size(kibibytes) * convert.Kibibyte).ToGibibytes())\n\n    // convert mebibytes\n    mebibytes := 7884.8\n    fmt.Printf(\"%.2f Mebibytes -\u003e %.2f Bytes\\n\",\n        mebibytes, (convert.Size(mebibytes) * convert.Mebibyte).ToBytes())\n    fmt.Printf(\"%.2f Mebibytes -\u003e %.2f Kibibytes\\n\",\n        mebibytes, (convert.Size(mebibytes) * convert.Mebibyte).ToKibibytes())\n    fmt.Printf(\"%.2f Mebibytes -\u003e %.2f Gibibytes\\n\",\n        mebibytes, (convert.Size(mebibytes) * convert.Mebibyte).ToGibibytes())\n\n    // convert gibibytes\n    gibibytes := 7.7\n    fmt.Printf(\"%.2f Gibibytes -\u003e %.2f Bytes\\n\",\n        gibibytes, (convert.Size(gibibytes) * convert.Gibibyte).ToBytes())\n    fmt.Printf(\"%.2f Gibibytes -\u003e %.2f Kibibytes\\n\",\n        gibibytes, (convert.Size(gibibytes) * convert.Gibibyte).ToKibibytes())\n    fmt.Printf(\"%.2f Gibibytes -\u003e %.2f Mebibytes\\n\",\n        gibibytes, (convert.Size(gibibytes) * convert.Gibibyte).ToMebibytes())\n    \n    // convert kilohertz\n    kilohertz := 3900000\n    fmt.Printf(\"%v Kilohertz -\u003e %v Herz\\n\",\n        kilohertz, (convert.Frequency(kilohertz) * convert.Kilohertz).ToHertz())\n    fmt.Printf(\"%v Kilohertz -\u003e %v Megahertz\\n\",\n        kilohertz, (convert.Frequency(kilohertz) * convert.Kilohertz).ToMegahertz())\n    fmt.Printf(\"%v Kilohertz -\u003e %v Gigahertz\\n\",\n        kilohertz, (convert.Frequency(kilohertz) * convert.Kilohertz).ToGigahertz())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdreptu%2Fsysinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdreptu%2Fsysinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdreptu%2Fsysinfo/lists"}