LinuxCommandLibrary

vcgencmd

Get Raspberry Pi hardware configuration and status

TLDR

List all available commands

$ vcgencmd commands
copy

Print the current CPU temperature
$ vcgencmd measure_temp
copy

Print the current voltage
$ vcgencmd measure_volts
copy

Print the throttled state of the system as a bit pattern
$ vcgencmd get_throttled
copy

Print the bootloader configuration (only available on Raspberry Pi 4 models)
$ vcgencmd bootloader_config
copy

Display help
$ vcgencmd --help
copy

SYNOPSIS

vcgencmd command [arguments]

PARAMETERS

help
    Displays a comprehensive list of all available vcgencmd commands and their basic usage.

commands
    Lists only the names of all available vcgencmd commands.

version
    Outputs the current firmware version and build date of the Raspberry Pi's VideoCore GPU.

measure_temp
    Reports the current temperature of the VideoCore GPU, typically in degrees Celsius.

measure_clock component
    Shows the clock frequency of a specified system component. Common components include arm (CPU), core (GPU core), h264 (video encoder), isp (Image Sensor Pipeline), and v3d (3D graphics).

measure_volts component
    Displays the voltage level of a specified hardware component. Common components include core (GPU core), sdram_c (SDRAM core), sdram_p (SDRAM PHY), and sdram_i (SDRAM I/O).

get_mem component
    Indicates the amount of memory (in MB) allocated to a specific component. Typically used with arm (for CPU) or gpu (for VideoCore).

get_throttled
    Retrieves the current throttling status, indicating if the system is under-voltaged, capped, or has reached thermal limits. The output is a bitmask.

get_config config_item
    Reads a specific configuration parameter from the system's config.txt file, such as arm_freq or gpu_mem.

codec_enabled codec_name
    Checks if a specific video codec is enabled. Examples include H264, MPG2, WVC1, MPG4, etc.

display_power 0|1
    Controls the power state of the connected display. Use 0 to turn off the display and 1 to turn it on.

get_camera
    Reports the status of the Raspberry Pi camera module, indicating if it is detected and enabled.

otp_dump
    Dumps the contents of the One-Time Programmable (OTP) memory, which stores unique device information and license keys.

get_board_revision
    Returns the revision code of the Raspberry Pi board, which can be used to identify the specific model and its features.

get_pixels
    Provides information about the current display resolution and refresh rate.

DESCRIPTION

The vcgencmd command is a powerful utility designed for Raspberry Pi devices, providing an interface to interact with the Broadcom VideoCore IV GPU. It allows users to retrieve a wide array of system information and control certain low-level hardware features that are managed by the GPU firmware.

Primarily used for diagnostics, performance monitoring, and advanced system configuration, vcgencmd can report on critical system metrics such as CPU and GPU temperature, clock frequencies of various components (ARM, core, V3D), voltage levels, and memory allocation between the ARM CPU and the GPU. It also provides insights into throttling status, firmware versions, camera module status, display power control, and information about supported video codecs.

As it directly interacts with the VideoCore firmware, vcgencmd is specific to Raspberry Pi hardware (models using Broadcom BCM283x/271x SoCs) and is an indispensable tool for understanding and fine-tuning the performance of these single-board computers.

CAVEATS

vcgencmd is exclusively designed for Raspberry Pi hardware and relies on the specific Broadcom VideoCore GPU firmware. It is not available or functional on other Linux systems.

While many commands can be run by a regular user, some operations, particularly those that modify settings or access sensitive hardware information, may require root privileges (e.g., using sudo). The output format is typically plain text, often in key=value pairs, which can be parsed by scripts.

USAGE AND SCRIPTING

vcgencmd is frequently used in shell scripts for automated monitoring, system status checks, and dynamic configuration adjustments. Its simple text output makes it easy to parse with standard command-line tools like grep, awk, and cut. For example, to log the GPU temperature every minute, one might use a simple cron job that calls vcgencmd measure_temp.

UNDERSTANDING THROTTLING

The output of vcgencmd get_throttled is a bitmask. Interpreting this value allows users to diagnose power supply issues (under-voltage), thermal throttling (over-temperature), or frequency capping due to various reasons. Consulting the official Raspberry Pi documentation provides a full breakdown of the bitmask values.

HISTORY

The vcgencmd utility emerged as part of the official Raspberry Pi userland tools, developed by Broadcom and the Raspberry Pi Foundation. Its inception was crucial for providing a user-space interface to the closed-source VideoCore IV GPU firmware, which manages significant aspects of the Raspberry Pi's hardware, including multimedia processing and power management.

Over time, as new Raspberry Pi models were released and the firmware evolved, vcgencmd has been updated to expose new functionalities, report on additional hardware components, and provide more detailed diagnostics. It has consistently been a core component for advanced users and developers for debugging, monitoring, and fine-tuning Raspberry Pi systems, solidifying its role as an essential low-level command-line tool.

SEE ALSO

raspi-config(1), dtparam(7), uname(1), lshw(1), dmesg(1)

Copied to clipboard