Set USB flash drive mount point under LINUX, copy USB flash drive files

Set USB flash drive mount point under LINUX, copy USB flash drive files

Use terminal to copy files in U disk under linux

After inserting the U disk into the computer, you need to check whether the storage device has been recognized by the system, and to obtain the path of the device, you
need to enter the root user to perform related operations. If it is a normal user, you need to obtain root user privileges (sudo -i input root user password)

fdisk -l  ##查看U盘是否被识别,以及U盘路径及名称

View U disk path and name
fdisk -lThe result after execution
My 64 g U disk has been identified, that is, sda1 is the name of my U disk, and the path is/dev/sda1

Then create a new directory usb under the root as the mount point of the U disk

mkdir /usb    ##在根目录下新建usb文件夹
mount /dev/sda1 /usb  ##将U盘挂载到根目录下的usb目录

There is a LINUX directory in my USB flash drive. I need to copy it and its contents to the desktop of ordinary LINUX users.

cp -r /usb/LINUX /home/erqian/Desktop

Copy the LINUX directory in the U disk to the desktop of ordinary user erqian
After the copy is complete, you need to exit the U disk mount point, and then unplug the physical U disk

umount /usb

Unplug the U disk after exiting successfully

Guess you like

Origin blog.csdn.net/weixin_42200500/article/details/115313680