mount
Command Cheatsheet
The mount
command in Unix-like systems is used to mount filesystems and network shares onto the directory tree. It is essential for managing storage devices and network shares efficiently. Here’s a quick reference guide:
Basic Syntax
mount [OPTION]... [DEVICE] [DIRECTORY]
Common Options
-t TYPE
,--types TYPE
: Specify the filesystem type (e.g., ext4, nfs).mount -t ext4 /dev/sdb1 /mnt/data
-o OPTIONS
,--options OPTIONS
: Mount options (e.g.,rw
for read-write,ro
for read-only).mount -o rw /dev/sdb1 /mnt/data
-a
,--all
: Mount all filesystems listed in/etc/fstab
(exceptnoauto
entries).mount -a
-r
,--read-only
: Mount the filesystem read-only.mount -o ro /dev/sdb1 /mnt/data
-v
,--verbose
: Verbose mode, print detailed information during the mount operation.mount -v /dev/sdb1 /mnt/data
Examples
Mount a device to a directory:
mount /dev/sdb1 /mnt/data
Mount a filesystem specifying type and options:
mount -t ext4 -o rw /dev/sdb1 /mnt/data
Mount all filesystems listed in
/etc/fstab
:mount -a
Mount a remote NFS share:
mount -t nfs server:/share /mnt/nfs
Unmount a mounted filesystem:
umount /mnt/data
Additional Information
List mounted filesystems:
mount
Help option:
mount --help
View manual page for
mount
:man mount
The mount
command is crucial for managing filesystems and network shares in Unix-like systems. It allows administrators to control storage devices and network resources effectively. For more detailed options and usage scenarios, refer to the man
page or use mount --help
.