Wednesday, November 20, 2013

Linux : how to mount Usb flash drive from command line

Linux : how to mount usb flash drive from command line

It's easy to mount a Usb flash drive in Linux from te bash by typing three Linux commands, I'm sure you will find others do it differently than me (using parameters).

Here, I will show you the simple method to do it (without using any parameters).

First, you need to know the device name (sdb*) after you plugged in the Usb flash drive by typing this command (It needs root permission)

sudo fdisk -l

The results will be :

sudo fdisk -l
sudo fdisk -l
The device name here is sdb1. sda1 sda2 ... are partitions of the hard drive.

Now, we need to create a Folder (we will use it later)

sudo mkdir /media/usb

We can mount it now in that folder we created

sudo mount /dev/sdb1 /media/usb

The content of the usb flash drive will be in this path /media/usb.
Before you reject it, you need to unmount it first by this command

sudo umount /dev/sdb1

In case, you want to mount it again, you don't need to create that folder again, because It is there.


Share this article :


Post a Comment