Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    quick question about cp command

    i would just mess around to figure this out, but i'm at work so i don't have the opportunity right now. however i am reading this book "understanding practical unix" by raymond greenlaw. for the cp command it says the syntax is:

    cp <name of file> <name of copied file>

    yet elsewhere i've read it goes like this:

    cp<name of file> <destination>

    now i'm confused at to how i would copy a file to a different destination.
    which is it?

    thanks, wes

  2. #2
    Join Date
    May 2004
    arch linux
    i usually rename files with cp and move files with mv

  3. #3
    Linux Guru budman7's Avatar
    Join Date
    Oct 2004
    Knee deep in Grand Rapids, Michigan
    This is from "man cp"
    If the last argument names an existing directory, cp copies each source
    file into that directory (retaining the same name). Otherwise, if only
    two files are given, it copies the first onto the second. It is an
    error if the last argument is not a directory and more than two non-
    option arguments are given.
    So it is both.
    Copy a single/multiple files to a Dir.
    Copy a single file, while rewriting another file.
    Depending on the arguments given.
    If you want to learn more about linux take a linux journey
    Use CODE tags when posting output of commands. Thank you.

  4. $spacer_open
  5. #4

  6. #5
    Join Date
    May 2004
    arch linux
    Be sure and check out all the options on the "move" command manpage, too. It's good to know cp and mv:

    man mv

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts