Monday, October 26, 2009

Copying files to / from / between linux servers, quick examples

using scp (like normal cp, but for servers):

$ scp file.txt user@remoteserver.com:mydir/file.txt
____copy file.txt from current directory to remote server under mydir

$ scp user@server1.com:file.txt user@server2.com:file.txt
____copy file.txt from server1 to server2

using sftp:

$ sftp user@server.com
____open secure ftp sessions
sftp> put file.txt
____copy file.txt from local directory to remote
sftp> get file.txt
____copy file.txt from remote to local directory where sftp was run
sftp> lls lpwd lcd
____putting an 'L' in front of the command lets you navigate local while logged into remote.

No comments: