CLI tool
gnomeria/usbtree avatar
gnomeria/usbtree

usbtree: a terminal USB device tree for Linux, macOS and Windows

Live USB device tree in your terminal. Rust TUI, no root, no libusb. Full activity metrics on Linux; device tree on macOS/Windows.

715 stars14 forksRustMIT

At a glance

What is it?
usbtree is a Rust TUI that enumerates USB devices through nusb with no root and no libusb. Full per-device activity metrics are Linux-only; macOS and Windows get the tree.
Who is it for?
Adopt usbtree if you want a fast, dependency-free way to read the USB topology on a Linux box and you care about per-device traffic without running a packet capture: the URB/s view works unprivileged, and usbmon bytes/s only needs sudo. Skip it if you need deep descriptor editing or class-level request inspection, or if you are on macOS and Windows and expect the activity graphs, since the README marks those Linux-only.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 10 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • gnomeria/usbtree715 ★ · +58
Star history
Repository2026-09-172026-11-22
gnomeria/usbtree657715

58 Stars in the last 66 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What usbtree solves, and who it is for

USB topology is easy to see on Linux if you know where to look and painful everywhere else. `lsusb` prints a flat list. `lsusb -t` prints a tree but no speed badges, no class gutter, no names beyond what the descriptor carries, and no live traffic. On macOS and Windows the situation is worse: the built-in tools are either buried in System Information or shipped as a separate GUI download. usbtree is aimed at the person who already lives in a terminal and wants the tree, the names, the speeds and the hot-plug events in one window without installing a USB stack.

The README frames the target audience indirectly through its constraints: pure Rust enumeration through nusb, no root required, no libusb, and a single static binary that the README describes as roughly 1.5 MB to download and 5 to 7 MB on disk. That combination matters for embedded developers, kernel-adjacent testers and anyone who has to debug a hub on a machine where they cannot install packages. The Linux-only activity metrics are the part that separates it from a plain viewer, and the README is explicit that this is the platform split.

How the tree is built: nusb, ratatui and a name fallback chain

The architecture is small enough to read off the manifest. Cargo.toml lists nusb 0.2.4 for enumeration, ratatui 0.30.2 for the TUI, usb-ids 1.2026.6 for the embedded name snapshot, and pci-ids 0.2.6 plus pci-info 0.4.0 for the PCI view. There is no libusb dependency, which is why the README can claim a static binary with zero runtime deps.

Enumeration through nusb gives the device descriptors, and usbtree turns those into a tree with hubs as parents and children nested underneath. The README describes the display layer in some detail: a color-coded class gutter, per-class icons, tree rails and speed badges where a low/full-speed device is marked with a small block, 480M high speed with a medium block, and SuperSpeed 5G or 10G with a full block. Hubs collapse with Enter, Space, h or l, and a collapsed hub shows a triangle plus a child count badge.

Names come from a fallback chain that the README spells out in order: `overrides.ids` first, then descriptor strings, then a downloaded usb.ids file, then the snapshot compiled into the binary, then vendor and class heuristics. The overrides file is the escape hatch for hardware that reports a useless string, and it wins over everything else. Composite devices with class 0xef are reclassified by their interface class, so the README's example of a MOTU M2 audio interface shows up as Audio rather than Misc. That is a small detail but it is the kind of thing that makes a tree readable when half your devices are hubs and the other half are composite.

Installing usbtree and printing a tree once

The README gives four install paths. Homebrew covers Linux and macOS on Apple Silicon, a shell installer covers Linux and macOS generally, a PowerShell one-liner covers Windows, and `cargo install --git` covers source builds. The shell installer downloads an archive and verifies its sha256 against `checksums.txt` before installing to `/usr/local/bin` or `~/.local/bin`.

bash
curl -fsSL https://raw.githubusercontent.com/gnomeria/usbtree/main/scripts/install.sh | sh

On Windows the equivalent is a PowerShell command that pipes the install script into `iex`, installing under `%LOCALAPPDATA%\usbtree\bin` and adding that to the user PATH.

powershell
irm https://raw.githubusercontent.com/gnomeria/usbtree/main/scripts/install.ps1 | iex

If you would rather build it yourself, the README gives the git form of cargo install. Note that this pulls the default branch rather than a released crate, since no crate version is listed for the package itself.

bash
cargo install --git https://github.com/gnomeria/usbtree

For a first real use, skip the TUI and print the tree once. This is the fastest way to confirm the tool sees your hardware the way you expect, and it works over SSH where a full-screen TUI is awkward.

bash
usbtree --dump

The README states that `--dump` prints the tree once and exits. If the names look wrong for a specific device, add a line to `~/.config/usbtree/overrides.ids` in the `vvvv:pppp Friendly Name` format and re-run. If the tree itself looks wrong, `usbtree --demo` builds a fake tree with scripted hot-plug events and traffic, which is a way to check the interface without any hardware attached.

Activity metrics are Linux-only, and that is the main limitation

The platform support table is the most important thing on the README, and it is worth reading carefully rather than skimming. The device tree, friendly names, hot-plug watch, the detail panel and prebuilt binaries are available on all three platforms. Device power (`bMaxPower`) is Linux and macOS only. Live activity sparklines and real bandwidth are Linux only, full stop.

On Linux the header tells you which source is active. The unprivileged default is `◌ urb activity`, which the README describes as URB-count deltas read from the sysfs `urbnum` attribute and displayed as URBs per second. The privileged mode is `◉ usbmon bytes/s`, real per-device bandwidth through usbmon, which requires root. The installer has an environment variable for this: setting `USBTREE_SUDO_SYMLINK=1` also creates a symlink in `/usr/local/bin` via sudo so that `sudo usbtree` can find the binary and reach usbmon.

So the honest summary is that the headline feature, per-device traffic, is a Linux feature with a privilege split inside it, and macOS and Windows users get a viewer. If you are on a Mac and you wanted the sparklines, this is the wrong tool, and the README does not pretend otherwise. The other limitation worth naming: the README documents no rollback path for `usbtree --upgrade`, which re-runs the platform installer. On Homebrew installs the README says to use `brew upgrade usbtree` instead, which is a real difference in behaviour between install methods.

Safe eject, the PCI view and the keys worth learning

Two features go beyond inspection. The first is safe eject on Linux: pressing `e` on a mass-storage device unmounts it and cuts port power through udisks2, with a confirmation dialog. The README describes this as unprivileged, which is plausible given udisks2's own policy layer, but it does mean the feature depends on udisks2 being present and configured on the machine. On a minimal server or a container host without it, that key has nothing to talk to. The README does not document what happens when udisks2 is missing.

The second is the PCI view, toggled with `p`. It is a flat, address-sorted list with a detail pane showing prog-if, subsystem, link speed and width, NUMA node, IOMMU group and power state. This is not a USB feature at all, and it is a reasonable addition because the two buses are usually debugged together, but it also means the binary carries pci-ids and pci-info for a view many users will never open.

The rest of the keymap is conventional for a ratatui application: j/k and arrows to move, g/G for top and bottom, `/` to filter the tree, Tab to switch focus between the tree and the event log, `y` to yank a vid:pid and `Y` for full details, `r` to force a rescan, `t` to toggle theme, and `q` or Esc to quit. The README also lists a `--light` flag for light-background terminals, which is a small thing that most TUIs get wrong.

How usbtree compares to lsusb and UsbTreeView

On Linux the direct comparison is `lsusb -t`. The difference is not just presentation. lsusb is part of usbutils, reads the same kernel data, and prints a snapshot with no interaction, no names beyond the descriptor, and no traffic counters. usbtree rescans every second, keeps a timestamped hot-plug log, and on Linux adds the URB/s counter from `urbnum`, which lsusb does not expose at all. The cost is that usbtree is a full-screen TUI, so it is worse than lsusb for scripting and for piping into another tool. If your goal is a one-line answer in a shell script, lsusb wins and `usbtree --dump` is the closest equivalent.

On Windows the usual reference point is UsbTreeView, a long-standing GUI utility. The approach differs in kind: UsbTreeView is a windowed application with deep descriptor and class-request inspection, and it is Windows-only. usbtree is a terminal program that runs on three platforms and deliberately stays shallow, showing the tree, names, speeds and (on Linux) activity rather than letting you issue control transfers. If you need to send a class-specific request to a device or decode a full descriptor dump byte by byte, usbtree is not that tool and the README does not claim it is. The search interest around UsbTreeView and around "usb tree viewer" generally is what makes this comparison worth stating plainly: the two tools share a name pattern and almost nothing else.

Licence, upgrade cost and what the repository shows about maintenance

usbtree is MIT licensed, which is permissive and imposes no obligation beyond keeping the copyright notice and the licence text with redistributions. The README does not discuss any commercial support, dual licensing or trademark terms, so there is nothing to weigh beyond the standard MIT grant. This is not legal advice; if you are bundling the binary into a product, read the LICENSE file in the repository.

The upgrade story is split by install method. For installer-based installs, `usbtree --upgrade` re-runs the official installer and honours the same environment variables, so `USBTREE_VERSION=0.1.0 usbtree --upgrade` pins a version and `USBTREE_INSTALL_DIR` picks the target directory. Homebrew users are told to use `brew upgrade usbtree` instead. The README does not document a downgrade path or a rollback, so pinning with `USBTREE_VERSION` before upgrading is the only documented way to control what you end up with.

On maintenance, the facts are narrow. The repository is not archived. The last push was on 2026-08-20, and the most recent release listed is v0.1.1 from 2026-07-31, preceded by v0.1.0 and v0.0.10, both from 2026-07-16. The version in Cargo.toml is 0.1.1, matching the release. That is a young project with a short release history, and the 0.x version number is consistent with that. The repository also carries a `vibe-coded` topic alongside cli, linux, macos, nusb, ratatui, rust, terminal, tui, usb and windows, which is a self-description rather than a quality signal either way.

Editorial conclusion

Adopt usbtree if you want a fast, dependency-free way to read the USB topology on a Linux box and you care about per-device traffic without running a packet capture: the URB/s view works unprivileged, and usbmon bytes/s only needs sudo. Skip it if you need deep descriptor editing or class-level request inspection, or if you are on macOS and Windows and expect the activity graphs, since the README marks those Linux-only. Before relying on it, run `usbtree --dump` and confirm the tree matches `lsusb -t` on your hardware, then check whether your distro's udisks2 is present if you plan to use the `e` safe-eject path.

Frequently asked questions

How do I use usbtree to view the USB device tree?

Run `usbtree` with no arguments to open the TUI, or `usbtree --dump` to print the tree once and exit. In the TUI, j/k or the arrow keys move the selection, Enter or Space collapses a hub, and `p` toggles the PCI view.

Is usbtree safe to run?

The README states that enumeration uses nusb in pure Rust with no root and no libusb, and that installers verify the archive's sha256 against checksums.txt. The one privileged path is usbmon for real bytes/s, which the README says requires root.

How do I install usbtree on Linux or macOS?

The README gives a Homebrew formula for Linux and macOS Apple Silicon, a shell installer that pipes scripts/install.sh into sh, and `cargo install --git https://github.com/gnomeria/usbtree` for source builds. Prebuilt archives are also published per release with sha256 checksums.

Official sources

  1. gnomeria/usbtree on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/gnomeria-usbtree.svg)](https://hysenlabs.com/projects/gnomeria-usbtree)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/gnomeria-usbtree.svg)](https://hysenlabs.com/projects/gnomeria-usbtree)

Was this useful?