Home·Terminal commands

umount

Files and directories

Usage

sudo umount [mountpoint]

Detaches a mounted filesystem; the name has no n in it, and it refuses with device is busy while any process still has a file or its working directory inside.

Common flags

FlagMeaning
-lLinux: detach lazily, as soon as nothing is using it
-fForce, which is what an unreachable network share needs
-RLinux: unmount everything below a path
-aUnmount everything listed in /etc/fstab

Examples

sudo umount /mnt

Detaches the filesystem.

sudo umount -l /mnt

Detaches as soon as the last user is done (Linux).

lsof +D /mnt

Finds what is holding it when it says target is busy.

Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does umount do?

Detaches a mounted filesystem; the name has no n in it, and it refuses with device is busy while any process still has a file or its working directory inside.

Q. How do I type it?

sudo umount [mountpoint] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

4 are listed here; the full set is in man umount. This command sits under Files and directories.

Related commands

man page: man umount