0

I want to know how to copy a folder from a desktop to an external disk like pen-drive using terminal in Ubuntu 16.04.

The name of the disk is /dev/sdb1 in my system.

What is the exact command for copying a folder into the pen-drive?

Zanna
  • 70,465

1 Answers1

4

There are two questions which need to be answered:

  1. How to copy a directory
  2. How to identify a mount-point of a device

The command to copy a folder is cp -r (a recursive copy)

You'll have to identify the path of your pen-drive.

If the pen-drive uses device /dev/sdb1, you will be able to get the path to the pen-drive (the mount point) using the df

The output of df looks like this:

df 

Filesystem     1K-blocks      Used Available Use% Mounted on
udev            16405712         0  16405712   0% /dev
tmpfs            3285172    141288   3143884   5% /run
/dev/sdb1      449093384  72712024 353545700  18% /
tmpfs           16425844    290220  16135624   2% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs           16425844         0  16425844   0% /sys/fs/cgroup
tmpfs            3285172       168   3285004   1% /run/user/1000
/dev/sdc1      976759804 389531656 587228148  40% /mnt/hddc1

hence if the device you'd like to use is /dev/sdc1 , the mount-point is /mnt/hddc1

For example, if you need to copy from /home/user/Desktop/folderName to pen-drive on sdc1 , the command will be:

cp -r /home/user/Desktop/folderName /mnt/hddc1
Yaron
  • 13,173