Basic scp commands

For this examples the user is called darth_vader and the remote host death_star.gov.

Single File

From host to server

In this section the user wants to upload the file called rebel_ids.tsv from his localhost to remotehost.

$ scp rebel_ids.tsv darth_vader@death_star.gov:/home/darth_vader/targets 

From server to host

The user wants to download fr the remotehost the file called flight_path.gpx.

$ scp darth_vader@death_star.gov:/shared/patrols/darth_vader/flight_path.gpx /home/darth_vader/autopilot/ 

Multiple Files

From host to server

Now, the user wants to upload two files, alderaan.gpx and despayre.gpx, to his home into remotehost:

$ scp alderaan.gpx despayre.gpx darth_vader@death_star.gov

From server to host

The user wants to download two files, personal_solo.pdf and personal_chubaca.pdf from remotehost

$ scp darth_vader@death_star.gov:/shared/intelligence/targets/{personal_solo.pdf,personal_chubaca.pdf} .

Direcotry

From host to server

$ scp -r foo darth_vader@death_star.gov:/home/darth_vader/personal/remote/directory/bar 

From server to host

$ scp -r darth_vader@death_star.gov:/home/darth_vader/jedi_doc .
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: