Skip to content
b1stedPublic

About

A minimal, fast system information tool for UNIX systems with no third-party dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

368 Commits

Folders and files

Repository files navigation

textfetch

Another fetch tool for UNIX systems, written just for fun.

CI Status Release Version basted packages Homebrew Tap License

Features • Output • Battery health • Supported Platforms • Installation • Build and run • License


A minimal, fast system information tool with no third-party dependencies. Designed to cleanly output hardware and software specifications natively using platform interfaces such as sysfs, procfs, sysctl, and IOKit.


textfetch demo
textfetch v1.3.0 on macOS


Features

  • CPU: Topology (physical core and logical thread counts), frequency, and model identification.
  • GPU: Vendor and device detection via DRM/sysfs (Linux), IOKit (macOS), and the system Vulkan driver (Android).
  • Power: Battery capacity, charging status, health status, and model (on Linux and macOS).
  • Memory & Storage: RAM/Swap usage and mounted filesystems with usage, size, and filesystem type.
  • Software: OS/distribution, kernel, uptime, shell, locale, process and thread counts, and device model.
  • Zero bloat: No third-party dependencies. Written in C99 with POSIX.1-2008 and platform APIs. Android/Termux uses the system Vulkan loader already present on the device.

Output

A typical Linux run:

basted@RyzenAT
--------------
OS: Arch Linux x86_64
Device: Lenovo ThinkBook 14 G5+ APO 21J1
Kernel: 7.2.14-arch1-1
Uptime: 2 days, 07:01:52
Processes: 566 (2645 threads)
Shell: zsh 5.9.2
Locale: en_US.UTF-8
CPU: AMD Ryzen 7 7840H (8C / 16T) @ 3.801 GHz
GPU: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 [0x15BF]
RAM: 12.00 GiB / 27.09 GiB (44%)
Swap: 0.11 GiB / 32.00 GiB (0%)
Disk (/): 147.42 GiB / 240.00 GiB (61%) [btrfs]
Battery (L21M4PD6): 100% (Full, Health: Good)
Field Description
basted@RyzenAT Current username and hostname.
OS Distribution or operating system, version, and machine architecture.
Device System or device model. Omitted when the platform exposes no model name.
Kernel Kernel release string.
Uptime Time elapsed since boot.
Processes Process count and total thread count reported by the kernel; the thread count is omitted when unavailable. When only system-wide data is available, a Threads line replaces it.
Shell Active interactive shell and version, resolved through the ancestor process chain. Falls back to $SHELL when no shell can be identified or queried.
Locale Active locale, preferring LC_ALL, LC_CTYPE, and LANG; on macOS CoreFoundation provides the graphical-session fallback.
CPU Model, physical cores (C), logical threads (T), and the highest available frequency. Missing topology or frequency details are omitted.
GPU GPU vendor and device name, with the PCI device ID on Linux. Linux names are resolved from pci.ids; the vendor falls back to Generic GPU when no matching entry is found.
RAM, Swap Used / total and percentage used. A system without swap shows Unused.
Disk (mount) Used / total, percentage used, and filesystem type. Each physical filesystem is shown once; pseudo, loop, FUSE, and EROFS mounts are skipped on Linux, and read-only/internal partitions are skipped on Android.
Battery (model) Charge percentage, power state, and health label. See Battery health.

The Processes line includes the total number of threads in parentheses, so it is normally greater than or equal to the process count. If the two samples are inconsistent or the thread counter is unavailable, only the process count is shown. On Linux the thread total comes from the kernel task counter in /proc/loadavg (falling back to sysinfo() when /proc is unrestricted). On Android, /proc uses hidepid and /proc/loadavg is restricted for ordinary apps, so full counters are used only when they are actually readable, for example when textfetch runs as root or from an adb shell. Otherwise the partial process count is omitted and a separate Threads line reports the system-wide task total from sysinfo(). Since sysinfo.procs is a 16-bit field, a value at its limit is shown as 65535+ rather than as an exact count. On macOS it is the sum of the thread counts reported for each process, with inaccessible processes contributing one thread as a lower bound.

Fields are omitted when the underlying platform API does not expose the data. Run with --verbose to print diagnostics explaining why a value could not be read.

On Linux, install pciutils or hwdata if the GPU line falls back to Generic GPU; textfetch reads pci.ids from the standard system locations.

Battery health

The Battery line shows the current charge level, power state, and a health label. Charge and health are different measurements: a battery can be charged to 100% while its health is Fair or Poor, because health describes how much capacity the battery has left compared with when it was new.

The power state may be Charging, Discharging, Full, Not Charging, or Unknown, depending on the platform and battery driver. On Linux it is read directly from sysfs; on macOS it is derived from IOKit power-source flags.

On Linux, textfetch estimates health from the ratio of the current full-charge capacity (energy_full or charge_full) to the original design capacity (energy_full_design or charge_full_design):

Health Meaning
Good The battery still holds at least 80% of its design capacity.
Fair The battery holds between 60% and 79% of its design capacity.
Poor The battery holds less than 60% of its design capacity.
Unknown The kernel does not expose the counters needed to estimate health.

On macOS, the label comes from IOKit's kIOPSBatteryHealthKey, so it reflects Apple's own battery health classification.

Linux battery health is an estimate based on the capacity counters exposed by the kernel; firmware or vendor utilities may report a slightly different value.

Supported Platforms

textfetch natively supports the following architectures and operating systems out-of-the-box:

  • macOS: Intel (x86_64) on Mac OS X 10.7+ (legacy build) or 10.9+ (modern build), and Apple Silicon (ARM64) on macOS 11.0+.
  • Linux: x86_64, ARM64, ARMv7, and RISC-V 64. CI builds all four; unit tests run on x86_64.
  • Android: Termux (aarch64, armv7, and x86_64) and other Android ABIs supported by the NDK.
  • IoT/Embedded: Builds for the Luckfox Pico Mini; CI produces the binary but does not run tests.

Installation

The easiest way to install and keep textfetch up to date is via the basted packages repositories or Homebrew. Standalone packages and archives are also attached to every GitHub Release.

Homebrew (macOS & Linux)

brew install b1sted/tap/textfetch

The tap tracks the latest stable release and builds it from source for the current platform.

Linux repositories (apt, dnf, pacman)

All Linux repositories carry native builds for amd64, arm64, armv7, and riscv64, signed with the repository key (packages.basted.dev/gpg.key).

Debian / Ubuntu (apt)

Supports Debian 12+, Ubuntu 22.04+, and compatible derivatives:

curl -fsSL https://packages.basted.dev/gpg.key \
  | sudo gpg --yes --dearmor -o /usr/share/keyrings/basted.gpg

echo "deb [signed-by=/usr/share/keyrings/basted.gpg] \
https://packages.basted.dev/apt stable main" \
  | sudo tee /etc/apt/sources.list.d/basted.list

sudo apt update
sudo apt install textfetch

Fedora / RHEL (dnf)

Supports Fedora, RHEL 9+, and compatible rebuilds:

sudo tee /etc/yum.repos.d/basted.repo >/dev/null <<'EOF'
[basted]
name=basted packages
baseurl=https://packages.basted.dev/rpm
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.basted.dev/gpg.key
EOF

sudo dnf install textfetch

Arch Linux (pacman)

curl -fsSL https://packages.basted.dev/gpg.key \
  | sudo pacman-key --add -
sudo pacman-key --lsign-key 3DFD8F2C2444ED194636CED66F19EE24A4124218

printf '\n[basted]\nSigLevel = Required DatabaseOptional\n%s\n' \
  'Server = https://packages.basted.dev/arch/$arch' \
  | sudo tee -a /etc/pacman.conf >/dev/null

sudo pacman -Syu
sudo pacman -S textfetch
Manual installation from GitHub Release packages (.deb / .rpm / .pkg.tar.zst)

Download the package for your distribution and architecture from the GitHub Releases page and install it locally:

# Debian / Ubuntu
sudo apt install ./textfetch_1.3.0_*.deb

# Fedora / RHEL / openSUSE
sudo dnf install ./textfetch-1.3.0.*.rpm

# Arch Linux
sudo pacman -U ./textfetch-1.3.0-*.pkg.tar.zst

Android (Termux)

Native Termux builds are available for aarch64, arm, and x86_64 via the Termux repository:

pkg install gnupg
mkdir -p "$PREFIX/etc/apt/trusted.gpg.d" "$PREFIX/etc/apt/sources.list.d"
curl -fsSL https://packages.basted.dev/gpg.key \
  | gpg --yes --dearmor -o "$PREFIX/etc/apt/trusted.gpg.d/basted.gpg"
echo "deb https://packages.basted.dev/termux stable main" \
  > "$PREFIX/etc/apt/sources.list.d/basted.list"

pkg update
pkg install textfetch
Manual installation from GitHub Release (.deb)

Termux release files use a textfetch-termux_ filename prefix so they are not confused with the native Linux packages, while the installed package name is textfetch:

pkg install ./textfetch-termux_1.3.0_*.deb

Prebuilt binaries (.tar.gz)

Standalone archives are published for Linux (amd64, arm64, armv7, riscv64, and Luckfox ARM), Android/Termux, and macOS (arm64, Intel modern, and Intel legacy). Download the archive for your platform, unpack it, and move textfetch onto your PATH:

tar -xzf textfetch-linux-amd64.tar.gz
sudo install -m 0755 textfetch /usr/local/bin/textfetch

Note

macOS marks binaries downloaded through a browser as quarantined. Remove the attribute before the first run:

xattr -d com.apple.quarantine ./textfetch

Verification

Release assets use a dedicated release signing subkey (github.com/b1sted.gpg), while package repositories use the package signing subkey (packages.basted.dev/gpg.key). Verify downloaded GitHub Release archives with any of the following methods:

# SHA256 checksums
sha256sum -c SHA256SUMS.txt --ignore-missing

# GPG signature
curl -fsSL https://github.com/b1sted.gpg | gpg --import && \
  gpg --verify SHA256SUMS.txt.asc SHA256SUMS.txt

# GitHub build attestation
gh attestation verify textfetch-linux-amd64.tar.gz --repo b1sted/textfetch

Build and run

Compilation from source

Requires a C99 compiler with a POSIX.1-2008 environment, GNU make, and the platform-specific APIs used for hardware discovery: Linux sysfs/procfs, macOS IOKit/CoreFoundation, and Android Bionic system properties. On macOS, install the Xcode Command Line Tools. On Android/Termux, only clang and make are needed; GPU detection loads the system Vulkan loader at runtime.

make

Build artifacts are written under build/ (build/bin/textfetch, build/obj/), so the source tree stays clean.

Install from source

sudo make install

PREFIX defaults to /usr/local; DESTDIR is supported for packaging:

make install PREFIX="$HOME/.local"
make install DESTDIR=/tmp/package PREFIX=/usr

Usage

./build/bin/textfetch

Run ./build/bin/textfetch --help for the full option list:

Option Description
-h, --human-readable Print sizes in human-readable format (default)
-k, --kibibytes Force kibibytes
-m, --mebibytes Force mebibytes
-g, --gibibytes Force gibibytes
-v, --verbose Explain what is being done
--no-color Disable color output
--help Display help and exit
-V, --version Output version information and exit

Note that -h selects human-readable sizes; use --help (there is no short form) to print usage.

-V prints the build version and machine architecture:

./build/bin/textfetch -V
# textfetch v1.3.0 (x86_64)

Override the version at build time with make VERSION=<version>; release builds derive it from the Git tag.

Formatting and color

Sizes use binary units (KiB, MiB, GiB, and so on). By default they scale automatically based on the largest value in each line. -k, -m, and -g force a fixed unit, while -h restores automatic scaling.

Color is enabled only when standard output is a terminal. Set NO_COLOR to any value or pass --no-color to disable ANSI styling. Verbose diagnostics are written to standard error, so --verbose does not contaminate piped output.

textfetch exits with status 0 on success and 1 when an unknown option is supplied.

Testing

The project ships with a self-contained test suite. make test builds and runs the regular test binaries; make leaks rebuilds the suite under AddressSanitizer and UndefinedBehaviorSanitizer (leak detection is enabled on Linux; Apple's ASan runtime does not support it) and also runs the main binary under the sanitizers:

make test
make leaks

Static analysis and formatting checks are available through clang-format, clang-tidy, and cppcheck:

make lint

make lint runs the mechanical style checks, then formatting, and finally both static analyzers. Missing analyzers are skipped for local development but fail the build when CI=true. The Tests and Linters GitHub Actions workflow runs make test, make leaks, and make lint.

ARM CPU ID database

ARM implementers and part numbers are stored in data/arm.ids and compiled into include/arm_ids.h. Edit only the database, then regenerate and verify the header:

make arm-ids
make validate-ids
make arm-ids-check

make validate-ids checks the database format, ordering, and duplicates. make arm-ids-check fails when the checked-in header does not match the database. The ARM IDs workflow runs both checks for pull requests, while the Refresh ARM IDs workflow periodically imports missing parts from the Linux kernel's arch/arm64/include/asm/cputype.h, opening a pull request against dev.

Additional developer targets include make dev (strict -Werror debug build), make leaks, make style-check, make arm-ids, make arm-ids-check, make validate-ids, make format, make format-check, and make clean.

License

Distributed under the MIT License.

You are free to use, modify, distribute, and sell this software. The only requirement is to preserve the copyright notice and the license file in any substantial portion of the software.

Full text of the license: LICENSE.

About

A minimal, fast system information tool for UNIX systems with no third-party dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages