Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible for me to use SSH to transfer files from my linux computer to my macbook, if so, can anyone post a brief tutorial? I kind of understand how to use SSH, but I need to know how to find out my hostname etc.

share|improve this question
The commands you're looking for are scp and sftp. – derobert Mar 20 '13 at 22:58

There are several ways to transfer files with SSH.

  1. scp (secure cp) - basic syntax is scp -r what where. what and where are either local files or remote ones. In the latter case, it is in the form [[user@]host:]file - e.g. arthur@camelot:path/to/file denotes a file located on computer camelot into which scp is supposed to log as user arthur; if the pathname is relative, it is relative to remote user's $HOME.

  2. sftp is an interactive FTP-like shell.

  3. tar c files | ssh user@host tar x - pipe a tar archive through ssh connection to tar spawned on the remote host. Can be reversed (ssh user@host tar c files | tar x). If you need to transfer just one file, using cat is also an option (TAR will keep file permissions and modes though).

  4. SSHFS - FUSE-based user mountable file system backed by SSH, which offers seamless integration into the file system hierarchy.

In all cases you have to have the SSH daemon running on at least one of the two machines. To find out hostname use the hostname utility. You can also use the IP address instead of the hostname - to find that one out use e.g. ifconfig or ip addr (on Linux, I don't know what is used on Mac OSX, which is of BSD heritage). If you have OpenSSH (which is very likely) check the man pages - they are rather well written.

An alternative (at least on local network) can be e.g. full encrypted NFS (v4+) export, which however is more difficult to set up (might be faster though, unless you use a specially patched version of OpenSSH targeted at HPC).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.