LinuxCommandLibrary

hp-levels

Show ink/toner levels for HP printers

SYNOPSIS

hp-levels [-h | --help] [-d | --device=DEVICE_URI] [-p | --printer=PRINTER] [-s | --sensor-path=PATH] [-i | --inks] [-t | --toners] [--set-levels=INK=PERCENT[,INK=PERCENT...]]

PARAMETERS

-h, --help
    Display full help message and exit

-d, --device=DEVICE_URI|DEV#
    Target HPLIP device by URI (e.g. hp:/usb/HP_LaserJet_Pro?serial=XYZ) or ID (e.g. hp1)

-p, --printer=PRINTER_NAME
    Target CUPS printer by name (e.g. HP-OfficeJet-6000)

-s, --sensor-path=SENSOR_PATH
    Use sysfs sensor path (e.g. /sys/devices/platform/hp/hplip/hp0/sensor1_level)

-i, --inks
    Display ink levels only (default for inkjets)

-t, --toners
    Display toner levels only (for laser printers)

--set-levels=INKNAME=PERCENT[,...]
    Set levels (e.g. black=50,cyan=20); INKNAME like black,k,c,m,y; requires sudo

DESCRIPTION

hp-levels is a utility from the HPLIP (HP Linux Imaging and Printing) package designed to display or modify the reported ink cartridge and toner levels on supported HP printers.

It communicates with the printer via USB, network, or CUPS backend to read hardware-reported levels, presenting them as percentages (0-100%). This is invaluable for monitoring supplies during printing workflows.

Advanced users and developers leverage the --set-levels option to simulate low ink/toner conditions for testing printer behavior, error handling, or firmware responses without replacing cartridges. Levels can be set per color: black, cyan, magenta, yellow, etc., depending on the model.

Without arguments, it targets the default HPLIP device or CUPS printer. Specify devices via URI (e.g., hp:/usb/Officejet_Pro_8600?serial=ABC123), ID (e.g., hp1), printer name, or sysfs sensor path for low-level access.

Requires HPLIP installed and printer powered on. Ink/toner modes differentiate laser (toner) from inkjet models. Output includes cartridge names, levels, and health status where available.

Common in enterprise print farms or home offices with HP hardware for proactive maintenance.

CAVEATS

Requires HPLIP package and printer online. --set-levels needs root (use sudo). Not all models support setting; resets on printer reboot/power cycle. Levels are software overrides, not hardware changes.

EXAMPLES

hp-levels
Show levels for default printer.

hp-levels -d hp:/net/HP_LaserJet_Pro_M404?ip=192.168.1.100
Query network printer inks/toners.

sudo hp-levels --set-levels=black=5,yellow=90 -p HP-DeskJet
Set black low, yellow high on named printer.

INK NAMES

Common: black, k (black), cyan, c, magenta, m, yellow, y, photo-black, photo-cyan, photo-magenta, photo-yellow. Model-specific; check hp-levels --help or printer docs.

HISTORY

Debuted in HPLIP 0.9.2 (2005) by HP and Linux Printing Project. Evolved with HPLIP to version 3.x (2023+), now under OpenPrinting.org. Added sensor support in 1.x for sysfs integration.

SEE ALSO

hp(1), hp-setup(8), hp-toolbox(1), hp-check(8), lpstat(1)

Copied to clipboard