Find the answer to your Linux question:
Results 1 to 3 of 3
hi guys, when copying or moving files or directories using cp or mv do you have to be in that working directory (be where the files or dirs are that ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    56

    quick one about cp and mv commands


    hi guys,

    when copying or moving files or directories using cp or mv

    do you have to be in that working directory (be where the files or dirs are that you want to copy) whats the quickest way to do this as i find some paths really long...is there a trick or secret to doing this?

    thanks
    j0n1n

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,504
    No. You can be anywhere the file system and use absolute paths (starting from the root). Personally, I usually end up in the destination directory so I can simply use . to mean to here
    Code:
    cp -R /home/someuser/filesinareallylongdirectoryname/to/copy .
    however the tab key is your friend when typing at the command line. Enter the first few characters and press tab...
    Code:
    cp -R /home/some<TAB>/fil<TAB>/to/copy .
    You'll love it
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    Dec 2012
    Posts
    56
    thanks for that man...this truly is the best forum i have ever laid my fingers on...

Posting Permissions

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