用 qrencode 在终端生成二维码

把网址或短文本编码成 ANSI 块绘制的二维码。

macOS网络终端低风险
运行 qrencode -t ANSIUTF8,终端会打印可直接扫描的二维码。

01命令

命令
$ qrencode -t ANSIUTF8 "https://cmdcv.com"

02作用说明

qrencode 支持多种输出格式,-t ANSIUTF8 会用块字符绘制二维码,手机摄像头可直接扫描屏幕。用 -o file.png 保存为图片,-s 设置模块大小。

03风险

风险低风险
使用条件brew install qrencode
系统兼容性macOS with Homebrew installed
!注意: 请用深色终端背景并保持文本简短;内容过长会生成难以扫描的密集二维码。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • qrencode
    Kentaro Fukuchi · vendor-doc · 2026-09-20
    依据: Official qrencode page documenting output types including ANSIUTF8.
  • Homebrew formula: qrencode
    Homebrew · vendor-doc · 2026-09-20
    依据: Installs qrencode, a QR Code encoder with ANSI terminal output.

最后验证: 2026-09-20 · 分类: 开发者

06相关方案