1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SSH line commands...

Discussion in 'Off Topic' started by vVv, Sep 24, 2012.

  1. vVv

    vVv Guest

    anyone know the line command for basically "copying" and placing the "copy" of folders from one location to another location on same domain name?

    example; domain.com/attachments/ [copy to] domain.com/blah/attachments/
    domain.com/avatars/ [copy to] domain.com/blah/avatars/

    also, line commands to SAVE backups of those directories FROM hosting account root/ to hard drive/computer... ?

    thanks in advanced... xD
  2. karll

    karll Well-Known Member

    First log in to the host -- this is how you do it from a Linux terminal:
    ssh username@domain.com

    Then, assuming you really have the files in a directory called domain.com/attachments:
    mkdir -p domain.com/blah/attachments/
    cp -pr domain.com/attachments/* domain.com/blah/attachments/.

    The first command creates the destination directory. The second does the actual copying; it will preserve the file ownerships and copies everything including subdirectories.
    vVv and Jake Bunce like this.
  3. karll

    karll Well-Known Member

    This is how you could do it from the Linux terminal. (Modify to suit your particular situation ....)

    scp root@domain.com:/root/backupfile.tar.gz .

    (Don't forget the "." at the end.) Of course, I think usually ssh is configured so that you can't ssh/scp directly with the root account.

    You can also copy a whole directory structure:
    scp -r root@domain.com:/root/backups .
    vVv likes this.
  4. vVv

    vVv Guest

    Yes!! :D Thank you Karll! :D Yeah, the second one for backing up the stuff from host account to hard drive, the host told me to do and it worked.. I just forgot the "how to", after all this other stuff was going on in life lol. But yeah, I use Putty to do this stuff... SSH is SO much easier! Especially when you have like 700MB worth of attachments to play with... :D Usually when I download 700MB movies, it takes me an hour and half lol
  5. vVv

    vVv Guest

    This worked for me.

    mkdir -p blah/attachments/
    cp -pr attachments/* blah/attachments/.

    Because doing the "domain.com/attachments/" was just making folders "domain.com" then sub directories, which wasn't working of course. Also, running those commands from "public_html" wasn't working either haha.. But the ones aboved worked, after "cd public_html" then.. ran above commands.. worked great...thanks again. xD
    Jake Bunce likes this.
  6. vVv

    vVv Guest

    Replying to this as reminder I need to do this again soon lol.

Share This Page