How to umount a USB drive?

Suppose your usb drive is mounted to /media/usb then it would be sufficient to do

sudo umount /media/usb

Suppose the your usb is /dev/sdb1 then you could also do

sudo umount /dev/sdb1

You may also have a look at the anwers of one of my questions, how to umount all attached usb devices with a single command: Umount all attached usb disks with a single command


You can also use

udisks --unmount /dev/sdb1

which does not require root.


For macOS:

diskutil umount /dev/sdb1

Better than using sudo to unmount as root, just install the pmount package and do:

pumount /media/usb

As man pumount says:

NAME
       pumount - umount arbitrary hotpluggable devices as normal user

SYNOPSIS
       pumount [ options ] device

DESCRIPTION
       pumount  is  a wrapper around the standard umount program which permits
       normal users to umount removable devices without a matching  /etc/fstab
       entry.