Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How can I copy files from and send files to a remote Linux machine on my Macbook Pro on a SSH connection?

Writer Sebastian Wright

Using my PC I just used Tunnelier, it took care of all the dirty work for me. Now that I have got a MacBook Pro (for design purposes) I am at a loss of how to send my files to the Linux server.

Any help would be appreciated.

5 Answers

rsync is the business.

rsync -chavz --partial --progress --stats source_files remotehost.domain:target_dir

Where:

--checksum -c -- skip based on checksums, not mod-time & size
--human-readable -h -- output numbers in a human-readable format
--archive -a -- archive mode; same as -rlptgoD (no -H)
--verbose -v -- increase verbosity
--compress -z -- compress file data during the transfer
--partial -- keep partially transferred files
--progress -- show progress during transfer
--stats -- give some file-transfer stats 

The great thing about rsync is that it only copies what it needs to. So if you run the command a second time, it should copy nothing at all (unless one of the files has changed on either end in the meantime). This is also useful if your transfer gets interrupted somehow. The output of the command above will give you some information on by how much it has sped up your file transfer.

2
scp pathToFileOnMBP username@linuxHost:pathToFileOnLinux

useful options:

-r for recursive copy

-P portnumber if you want to use a port other than 22 (standard ssh)

Open Terminal ( press Command key + Space, type "Terminal", press Enter )

In the Terminal type:

scp -r path_to_your_files user@linuxserver:~

It will ask for the user's (your) password and will copy "your_files" to the user's home directory (~).

In case you need to copy it to another directory on the Linux server:

scp -r path_to_your_files user@linuxserver:path_to_another_directory

Make sure "user" has write permissions to "path_to_another_directory"

Here is the man page (instructions manual) for using SCP

Make sure you have your ssh keys set up in your home directory (~/.ssh) with the correct permissions (chmod 600)

Then you can type scp PATH_TO_FILE username@server:PATH_TO_DESTINATION

Example: scp abc.txt myuser@linuxserver:~/ will copy the abc.txt file and copy it to the home directory on the linux server.

If everything is working properly, you should see a progress bar and it will let you know when it is complete.

There are lots of ways. Just to name a few:

  • Terminal has Shell -> New Remote Connection, where you can choose an sftp connection. This opens an interactive command line sftp-client.
  • Straight scp as others have mentioned

If you are more GUI-inclined:

If you like paying:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy