bash command to copy file from one computer to another

38,920

Solution 1

You can use scp (Secure Copy).

To copy FROM your machine to friends:

scp file_to_copy [email protected]:/path/to/location

In another direction:

scp [email protected]:/path/locatio/file_name file_name

If you need to copy an entire directory, you'll need to use the recursive flag, like this:

scp -r directory_to_copy [email protected]:/path/to/location

Solution 2

Assuming you're logged in on macbook_b:

scp file_to_copy username@macbook_a:/path/to/destination

or if you're logged in on macbook_a:

scp username@macbook_b:/path/to/file_to_copy local_destination
Share:
38,920
MorganR
Author by

MorganR

Updated on July 05, 2022

Comments

  • MorganR
    MorganR almost 2 years

    Wasn't quite sure how to word this but let's say I've used ssh to remote into my friends MacBook (macbook_b) from my MacBook (macbook_a).

    What command would I use to copy a file/directory to my MacBook (macbook_a) from my friends MacBook (macbook_b)?

    Thank you.