Copy Files to USB in Linux
In Linux, the cp command can be used to copy files to a USB drive.
First, insert the USB flash drive into the computer, and then open the terminal.
Use the lsblk command to check the device name assigned to the USB drive in the system. The USB drive is usually displayed in the form of /dev/sdX, where X is a letter.
Next, use the mount command to mount the USB drive to a directory. Assuming the device name of the USB drive is /dev/sdb1, you can use the following command to mount it to the /mnt/usb directory:
sudo mount /dev/sdb1 /mnt/usb
If the directory does not exist, you can use the mkdir command to create it.
sudo mkdir /mnt/usb
Next, use the cp command to copy the file to the mounted USB flash drive. For example, to copy the file file.txt to the USB flash drive:
sudo cp file.txt /mnt/usb
After copying is completed, use the umount command to unmount the USB drive.
sudo umount /mnt/usb
Now, it is safe to remove the USB drive from the computer.