Linux Remote Upload & Download

download a file from the server

scp username@servername:/path/filename /var/www/local_dir

scp [email protected]:/root/bigfish6.jpg /                            ⏎
[email protected]'s password:
/bigfish6.jpg: Read-only file system  // didn't work cause i don't have write right

upload a local file to the server

scp /path/filename username@servername:/path

scp /Users/nedrain/Desktop/bigfish6.jpg [email protected]:/root/    

// you can see
┌─[root@mycentos]─[~]
└──╼ $ls
anaconda-ks.cfg  bigfish6.jpg

download a directory from the server

scp -r username@servername:/var/www/remote_dir/ /var/www/local_dir

scp -r [email protected]:/root/  /Users/nedrain/test/

upload a directory to the server

scp -r local_dir username@servername:remote_dir

scp -r /Users/nedrain/test/ [email protected]:/root/

猜你喜欢

转载自www.cnblogs.com/nedrain/p/13161215.html