0

I have OpenBSD 5.6 installed on my notebook computer and would like to copy files from my USB flash drive to the root of the installed OS. I figured out how to mount the USB drive using these commands:

# mkdir /mnt/usb
# mount /dev/sd1i /mnt/usb
# cd /mnt/usb

How do I copy files from /mnt/usb to the root of the installed OS?

1

The basic command to copy files is cp. You might want to use ls first to get a list of files (and directories):

cp some_file ~/new_name

copies a file under /mnt/usb to the file new_name in your home directory.

If you want to copy all files ending in .jpg and .JPEG to a new directory pictures under your home directory, you can use e.g.:

mkdir ~/pictures/
cp *.jpg *.JPEG ~/pictures/

I recommend you keep your root directory clean, but if you have to copy things there, / is the path to root, so the last command would be:

cp *.jpg *.JPEG /
  • You wrote copies a file under /mnt/usb to the file new_name in your home directory. I don't understand. When I log in as root using the root password, I'll be in the root directory, right? There's no such thing as a home directory when I log in as root?? – user66229 Nov 11 '14 at 11:26
  • You wrote If you want to copy all files ending in .jpg and .JPEG to a new directory pictures under your home directory. Suppose I wish to copy all files ending in .jpg and .JPEG to the root directory, what command should I type? – user66229 Nov 11 '14 at 11:29
  • 1
    @user66229 I advise against that (you should keep root clean), but the root directory of your disc is /, so cp *.jpg *.JPEG / would do that. – Anthon Nov 11 '14 at 11:39
  • Your command cp *.jpg *.JPEG / assumes that I'm in /mnt/usb directory, right? Suppose I'm in the root directory /, what is the corresponding command? Is it cp /mnt/usb/*.jpg /?? And can I suppose that cp /mnt/usb/*.jpg / is valid for both Debian and OpenBSD? – user66229 Nov 11 '14 at 12:13
  • 1
    @user66229 Yes I assume that since you provide step 4. You provide correct command (cp /mnt/usb/*.jpg /) and it should work on both independent of the shell you are running on either OS. – Anthon Nov 11 '14 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.