Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2002
    Posts
    1,926

    Need some help with SSH command

    Well, what I'm basicly trying to do is copy the entire content of a folder (including all subdirectories and files in them) to a backup on a second harddrive. I'd just like to know if there's a command for this in SSH like xcopy in DOS. I did try to make the backups with reoback, but it keeps giving me a load of errors, so I guess I'll have to do it by hand.

    Any help appreciated.

  2. #2
    Join Date
    Dec 2001
    Location
    Detroit, MI
    Posts
    1,067
    Try scp, it's rcp using ssh.

    edit
    oops, guess I should have consumed the message better before posting, I was thinking you wanted to copy via ssh. Ffeingol is correct.
    Last edited by ScottD; 06-06-2002 at 06:23 PM.
    <!-- boo! -->

  3. #3
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,258
    cp -Rp /source /dest

    -R is recursive -p is retain permissions/ownership. You prob. won't be able to use the -p part unless you are root.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  4. #4
    Join Date
    Feb 2002
    Posts
    1,926
    Hmm, looks like the cp command just creates symbolic links back to the data on the first drive, that's not what I'm trying to achieve. I want to make a real backup of the data on drive 1 on the second drive so it is physicly (sp?) on both drives...

    Thanks for trying though...

    Should say that I want this data on drive 2 as I will be formatting drive one to install Redhat 7.2 and the new version of Ensim as soon as I have the backups made.
    Last edited by Tazzman; 06-06-2002 at 07:31 PM.

  5. #5
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,258
    cp does not create symbolic links (unless the file is a link). cp is the *nix copy command.

    If you're doing this for backups, look at rsync. rsync will just copy what has changed.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  6. #6
    Join Date
    Feb 2002
    Posts
    1,926
    Yeah, you're right, they're symbolic links themselves, just noticed. Darn this Ensim file structure, symbolic links everywhere ...

    Found the folders I really needed, thanks for your patience. Anybody happen to know a site where all the SSH commands are listed. I am learning as I go along, but a reference would be nice
    Last edited by Tazzman; 06-06-2002 at 07:45 PM.

  7. #7
    Join Date
    Jun 2002
    Location
    PA, USA
    Posts
    5,137

    Re: Need some help with SSH command

    Originally posted by Tazzman
    Well, what I'm basicly trying to do is copy the entire content of a folder (including all subdirectories and files in them) to a backup on a second harddrive. I'd just like to know if there's a command for this in SSH like xcopy in DOS. I did try to make the backups with reoback, but it keeps giving me a load of errors, so I guess I'll have to do it by hand.

    Any help appreciated.
    Since this is just for a backup purpose, why not use tar?

    'tar -cf target_filename.tar source_directory/'

    You will get one tar file and later on you can unarchived this. The good thing about tar is that since it will produce only one file, you can then gzip it to save some space

    'gzip target_filename.tar'

    Good luck

    regards,
    -dave
    Fluid Hosting, LLC - HSphere Shared and Reseller hosting - Now with HIGH AVAILABILITY
    Fluid VPS - Linux and Windows Virtuozzo VPS - Enterprise VPS with up to 2 GB guaranteed memory!
    Get your N+1 High Availability Enterprise Cloud
    Equinix Secaucus NY2 (NYC Metro)

  8. #8
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,258
    I was guessing that Tazzman just wanted to backup certain directories to a second drive. If that's the case, rsync is great for that.

    If you're going to use tar, save yourself a step.

    tar -czf you-tar-file.tar.gz /some/input/

    The gnu version of tar (on most Linux boxes) takes the -z parameter which will do the gzip on the fly.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  9. #9
    Join Date
    Feb 2002
    Posts
    1,926
    I have no need to tar the files as I have 2 40 gig drives, I can just mirror and save myself some time

    Rsync looks nice. I'll have to have a look if I can add it to cron once I have Redhat 7.2 installed and the server back into good condition...

  10. #10
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,258
    Yep,

    rsync is very easy to cron. Look at their examples page and you'll see some good methods for setting up scripts.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  11. #11
    Join Date
    Apr 2002
    Location
    Sacramento, CA
    Posts
    220
    When you tar a directory and all files in it, will it still retain its permissions?

    What is the command to download a file via SSH?
    Joel Strellner

  12. #12
    Join Date
    Feb 2002
    Posts
    1,926
    depends, if you just want to download a file from an ftp or website it would be:

    wget ftp://123.456.789.10/filename.zip or wget www.files4all.com/filename.zip

  13. #13
    Join Date
    Mar 2001
    Location
    California
    Posts
    332
    Originally posted by xerocity.com

    What is the command to download a file via SSH?
    scp

    Try man scp

Posting Permissions

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