umount
Command Cheatsheet
The umount
command in Unix-like systems is used to unmount filesystems and network shares from the directory tree. It is essential for safely detaching storage devices and network mounts. Here’s a quick reference guide:
Basic Syntax
umount [OPTION]... [DIRECTORY | DEVICE]
Common Options
-f
,--force
: Force unmount (terminate processes using the mounted filesystem).umount -f /mnt/data
-l
,--lazy
: Detach filesystem immediately, but clean up later (often used with NFS mounts).umount -l /mnt/nfs
-r
,--read-only
: Unmount the filesystem as read-only.umount -r /mnt/data
-v
,--verbose
: Verbose mode, print detailed information during the unmount operation.umount -v /mnt/data
Examples
Unmount a directory:
umount /mnt/data
Force unmount a directory (terminate processes using it):
umount -f /mnt/data
Lazy unmount (detach immediately, clean up later):
umount -l /mnt/nfs
Unmount a read-only filesystem:
umount -r /mnt/data
Additional Information
List mounted filesystems:
mount
Help option:
umount --help
View manual page for
umount
:man umount
The umount
command is essential for safely unmounting filesystems and network shares in Unix-like systems. It ensures that all data is flushed to disk and processes using the mounted filesystem are gracefully terminated. For more detailed options and usage scenarios, refer to the man
page or use umount --help
.