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

    Smile How to use mv command in Putty

    Hi all,

    Since its my first time the using command line in Putty I am having some difficulties. Maybe someone could help me out or point me in the right direction.

    Right know I made a file name gorilla.tar.gz in public_html/monkeys/
    But i wanna put it in public_html/zoo/ and than extract it there.

    when I do mv gorilla.tar.gz public_htm/zoo/
    i get an error message.

    So in a nutshell. On the same server i wanna move a file from one directory (monkeys) to another (zoo)

    Oh I also used PWD to see where i am, but i haven't no clue what parts to use in the MV command.

    Hope to hear from some guru's

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    the hills
    That's mv <present location> <new location>
    Do you have write permission in the new location?
    What is the exact error message?

    I'm assuming you are working at a command shell,
    through telnet or ssh. Ftp commands are different.

  3. #3
    Wow thx for your lightning speed reponse.
    I am pretty sure i have writing permission in the new folder. But the problem I am facing is that I dont know what path to include. If I type "pwd" I get a wickedly long path /www/d/a/v/

    I must say i just started today with this commandline stuf, but I'ts hard to find the the proper examples. Is there maybe some guide with working examples instead of the riddled stuff i get when typing "man"

    I also tried this guide which i am not allowed to link to?: Oh Learning Journal - Backup / Move a Website I that explain how to make a tarbal, which works in a way but i always get the error:
    (tar: getgrgid(80) failed: Permission denied)

    Anyways i used this line which i found somewhere:
    cp -av * ../newdir : Copies all files and directories recurrsively in the current directory INTO newdir

    so I type in when I am standing in the target directory (monkeys):
    cp -av * /public_html/zoo

    resulting in this error: usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file
    cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... target_directory

    This is really mind goggling for me

  4. $spacer_open
  5. #4


    Well it seems i found a workaround, but please inform me if this was the right way.
    The goal was to copy all files and folders from one directory(gorilla) into another (zoo). This is what i did and it seems it worked:

    Logged in to PuTTy and than went to public_html by using: cd public_html
    I than typed the following:
    cp -rp ~/public_html/gorilla/* ~/public_html/zoo/

    This seemed to have worked, i added the ~ myself because I had difficulties knowing the stuff to put in infront and without out it i kept getting errors like:
    no such file or directory.

    Would love to hear from you guys since this forum is named after me

  6. #5
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    the hills
    The ~ symbol is shorthand for the user's home directory,
    so if it worked, yes that's good. It's easier than typing that
    long path.

  7. #6
    Thanks alot m8 for spending time on my post. Maybe it even helps someone else, would be nice

    Btw i saw alot of examples on the internet with indeed /home/... in it, but when in did pwd, i didn't see a home folder. Maybe thats because I am on a shared host (but that's just a wild uneducated guess). Atleast i now know how to deal with it. Thanks for confirming this,

  8. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Either at home or at work or down the pub
    You could also have done

    mv ~/public_html/gorilla/* ~/public_html/zoo/
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!

    The Fifth Continent

  9. #8
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Boston, MA
    Also helpful rather than writing out long directory names is to utilize tab completion. Incredibly useful feature of BASH and other shells.

  10. #9
    Oh nice, Thx guys really appreciate it. Soon ill be a command line guru

Posting Permissions

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