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

SSH line commands...

V

vVv

Guest
#1
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
 

karll

Well-known member
#2
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.
 

karll

Well-known member
#3
also, line commands to SAVE backups of those directories FROM hosting account root/ to hard drive/computer... ?
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 .
 
V

vVv

Guest
#4
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
 
V

vVv

Guest
#5
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