lprun is a lightweight, fast, and extensible command-line printing
tool written in C.
It acts as a smarter alternative to traditional UNIX tools like lp and
lpr, while adding:
- automatic network printer discovery\
- USB printer detection\
- simple text & image printing\
- CUPS integration\
- a clean plugin-ready architecture
lprun is designed for Linux users who want full control of their
printers from the terminal, without relying on heavy GUI utilities.
-
🔍 Auto-detect network printers using:
- ARP scanning\
- CUPS browsing\
- JetDirect port detection (9100)
-
🔌 Automatic USB printer detection
-
🖨 Print text or images easily:
lprun --text "Hello world" lprun --image ~/photo.png
-
📡 Print directly over port 9100 (raw JetDirect)
-
🧠 CUPS-backed printing support:
lprun --file document.pdf --printer "Canon G3020 series"
mkdir build
cd build
cmake ..
make
sudo make installmakelprun --listlprun --text "Hello world"lprun --file notes.txtlprun --image picture.pnglprun --printer "Canon G3020 series" --file report.pdflprun --raw --host 192.168.1.50 --file mydoc.txtOption Description
--discover Scan local network + USB for printers
--printer <name> Choose printer manually
--text "<string>" Print inline text
--file <path> Print any file
--image <path> Convert + print PNG/JPG images
--copies N Number of copies
--raw Send raw data directly to printer
--host <IP> Printer IP (JetDirect mode)
--help Show help
lprun/
│
├── src/
│ ├── lprun.c
│ ├── disc.c
│ ├── print.c
│ ├── util.c
│
├── include/
│ ├── disc.h
│ ├── print_raw.h
│ ├── print_cups.h
│ ├── util.h
│
├── README.md
├── Makefile
└── CMakeLists.txt
- C standard library
- CUPS development libraries
(libcups+cups-devel) - libc / GNU extensions (
_GNU_SOURCE) - Optional: NetPBM or ImageMagick for PNG/JPG → raster conversion
Arch Linux:
sudo pacman -S cups cups-filters libcups netpbmDebian/Ubuntu:
sudo apt install libcups2-dev cups-filtersecho -e "TEST PAGE\n" | lprun --raw --host 192.168.1.50- PDF → raster conversion inside lprun
- support for ESC/POS receipt printers
- auto-install CUPS drivers
- QR code generation
- full scanning module
MIT License
Pull requests are welcome!