brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: diskutil list external physical shows plugged-in disks only, a macos safety step

macOS
~/tips/tip-macos-diskutil-list-external-physical

diskutil list external physical

Lists only external physical drives so you pick the right disk before erasing.

Formatting the wrong disk is the mistake I fear most. I first list only the drives I just plugged in.

diskutil list external physical
diskutil info disk4 | grep -E 'Device Node|Media Name|Disk Size'

The filter words external and physical hide the internal drive and disk images, so only USB or Thunderbolt disks remain. diskutil info then confirms the model name and size of one identifier.

Identifiers like disk4 can change after you reconnect a drive, so read them again right before a command such as diskutil eraseDisk, which has no undo. A quick look at the size and name in diskutil info is usually enough to tell a backup drive from a stick.

Further reading: diskutil manual page

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link