September 21, 2025
Linux Command Line

Linux Command Line

The “mount” command in Linux is used to mount file systems, USB drives, and other storage devices to the file system hierarchy. The basic syntax of the command is as follows:

mount [-options] device directory

The “device” argument is the location of the device or file system that you want to mount, and the “directory” argument is the location where you want the device or file system to be mounted. For example, to mount a USB drive at /mnt/usb, you would use the following command:

mount /dev/sdb1 /mnt/usb

The “mount” command can also be used with a variety of options to control how the file system is mounted. Some of the most commonly used options include:

  • -t: specifies the file system type. For example, you can use -t ext4 to mount an ext4 file system.
  • -o: specifies additional options for the file system. For example, you can use -o rw to mount the file system with read-write permissions.
  • -r: mount the file system read-only.
  • -n: avoid updating /etc/mtab file.
  • -a: mount all file systems mentioned in /etc/fstab.

For example, to mount a USB drive with read-write permissions and the ext4 file system type, you would use the following command:

mount -t ext4 -o rw /dev/sdb1 /mnt/usb

It is also important to note that the /etc/fstab file contains information about file systems that are to be automatically mounted when the system boots up. It contains six fields per line, separated by spaces or tabs:

  • the device or file system to be mounted,
  • the mount point,
  • the file system type,
  • mount options,
  • dump (0 or 1),
  • fsck order.

You can also use this file to mount file systems at boot time, without manual intervention.

Finally, the umount command is used to unmount file systems that have been previously mounted using the “mount” command. The basic syntax of the command is as follows:

umount directory

The “directory” argument is the location of the mount point where the file system is currently mounted. For example, to unmount the USB drive that was previously mounted at /mnt/usb, you would use the following command:

umount /mnt/usb

The “mount” and “umount” commands are powerful tools that allow you to easily access and manage storage devices in Linux. With a little practice, you’ll be able to use these commands to mount and unmount file systems with ease.

See our list of 75 Linux commands you should know about.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link
Powered by Social Snap