Find the answer to your Linux question:
Results 1 to 5 of 5
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" ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2005
    Posts
    23

    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
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    i usually rename files with cp and move files with mv

  3. #3
    Linux Guru budman7's Avatar
    Join Date
    Oct 2004
    Location
    Knee deep in Grand Rapids, Michigan
    Posts
    3,242
    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.
    How to know if you are a geek.
    when you respond to "get a life!" with "what's the URL?"
    - Birger

    New users read The FAQ

  4. #4
    Just Joined!
    Join Date
    Jun 2005
    Posts
    23
    thanks

  5. #5
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Be sure and check out all the options on the "move" command manpage, too. It's good to know cp and mv:

    Code:
    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
  •