How to unmount and mount pen drive in ubuntu via command line [duplicate]

A. Identify the pendrive with the following commands

sudo parted -ls
sudo lsblk -fm

best in a wide terminal window (to avoid line wrapping)

df -h

to check if it is already mounted

B. Create mount points with mkdir and mount with the mount command

sudo mkdir /mnt/sdn

Make the mount point only the first time; n can be a number 1 or 2 ...

sudo mount /dev/sdxm /mnt/sdn

x is the drive letter, m is the partition number

for example

sudo mkdir /mnt/sd1
sudo mount /dev/sdb1 /mnt/sd1

C. Unmount with umount

sudo umount /mnt/sdn

where n can be a number 1 or 2 ...

or

sudo umount /dev/sdxm

where x is the drive letter and m is the partition number identified according to the command lines in A. (parted, lsblk, df).