LinuxCommandLibrary

facter

Gather system facts

SYNOPSIS

facter [options] [factnames]

PARAMETERS

-h, --help
    Print usage information

-V, --version
    Print facter version

--json
    Output facts as JSON

--yaml
    Output facts as YAML

--puppet
    Output in legacy Puppet format

--custom-dir DIR
    Directory for custom facts (default: /etc/facter/facts.d)

--no-custom-facts
    Disable custom facts

--no-external-facts
    Disable external script facts

--no-ruby
    Disable Ruby-based facts

-v, --verbose
    Verbose output

--timing
    Show resolution timing

--show-legacy
    Include legacy facts

DESCRIPTION

Facter is a standalone command-line utility that collects and displays detailed information, or 'facts', about a host system. These facts include operating system details, hardware specifications, network interfaces, memory usage, processor architecture, and custom data. Primarily used in configuration management with Puppet, but versatile for scripting and automation.

Facts are categorized as core (built-in, always available), structured (typed values like integers/arrays), external (executable scripts), and custom (user-defined). Facter aggregates data from system calls, files, and plugins without side effects.

Output formats include human-readable text, JSON, YAML, or legacy Puppet S-expression style. Query specific facts by name or list all. Versions 4.x use a performant C++ core with Ruby extensions for advanced facts. Ideal for idempotent inventory in DevOps pipelines. Requires installation via package managers; some facts need elevated privileges.

CAVEATS

Some facts require root access. Custom facts must be executable scripts outputting KEY=value. Not all facts available on every OS/architecture.

EXAMPLES

facter kernel
Display kernel fact.

facter --json networking
JSON output for networking facts.

facter -p
Legacy Puppet format.

HISTORY

Created by Puppet Labs in 2005 alongside Puppet 0.23.0 as a Ruby tool. Version 2.x (2013) introduced structured facts. 3.x added resolution chains. 4.x (2017+) rewritten in C++ for speed/portability, now Apache-2.0 licensed under Puppet.

SEE ALSO

puppet(8), ohai(1), lscpu(1), dmidecode(8)

Copied to clipboard