I have logged on to a system with ssh and there is no scp present on both the systems. How to copy a file without using the scp program.

  • Is netcat (nc) present on both systems? If it is, use your ssh session to tunnel a TCP port and use nc on that port.
    – n.m.
    Jun 1, 2011 at 9:06
  • Do you have rsync?
    – slhck
    Jun 1, 2011 at 9:08
  • 3
    you can also do this: ssh user@remotehost cat /path/to/remote/file > /path/to/local/file Jun 1, 2011 at 9:11
  • @n.m. quotes required (for me, ubuntu server)
    – Ivan Black
    Sep 19, 2014 at 10:12
  • @n.m. Doesn't work for me - file is corrupted (I guess the login message breaks it).
    – monnef
    Jun 25, 2017 at 12:10

5 Answers 5


To send a file:

cat file | ssh ajw@dogmatix "cat > remote"


ssh ajw@dogmatix "cat > remote" < file

To receive a file:

ssh ajw@dogmatix "cat remote" > copy
  • 21
    @ggg that's not true at all. cd /tmp; cat /bin/bash > test; chmod a+x test; diff test /bin/bash; ./test all works fine. There's nothing inherently "magic" about binary files. Both files in my example compared identical and have the same checksum. It's true that copy and pasting from a terminal window won't work because of things like control sequences and unprintable characters, but using pipes like this these never go near a terminal.
    – Flexo
    Sep 23, 2012 at 10:35
  • @Flexo I need something like this, the only exception is, I need to pipe in all jpg from a folder. How could iterate through /storage/sdcard1/*jpg and > to files with the same name ? Jul 3, 2013 at 11:58
  • 2
    @GeorgeProfenza you'll need to add tar into the mix. tar cvf - /path/*.jpg | ssh [email protected] "tar xvf -" or something similar ought to work.
    – Flexo
    Jul 3, 2013 at 20:36
  • One implication of what ggg and Flexo say above is that you can't use the "-t" option to ssh.
    – mjg123
    Nov 5, 2014 at 13:43
  • 1
    Nice! You can also use pv instead of the first cat so you get a progressbar, eg pv file | ssh ajw@dogmatix "cat > remote"
    – Theolodus
    May 18, 2018 at 9:14

Try this:

cat myfile.txt | ssh me@otherhost 'cat - > myfile.txt' 
  • 2
    no need for that many cat calls at all
    – Flexo
    Jun 1, 2011 at 9:13
  • What is that symbol, "-", near cat for? Apr 7, 2022 at 21:25
  • 1
    @RenanWillianPrado It tells cat specifically to read from stdin. Mostly useful to concatenate stdin after another file.
    – Keith
    Apr 8, 2022 at 9:30

You can use xxd and some ugly quoting to copy over multiple files as well as run commands on them and execute them:

ssh -t [email protected] "
echo $'"$(cat somefile | xxd -ps)"' | xxd -ps -r > "'somefile'"
chmod +x somefile
echo $'"$(cat someotherfile | xxd -ps)"' | xxd -ps -r > "'someotherfile'"
chmod +x someotherfile
  • ah, my answer is clearly too l33t
    – Aric
    Jan 8, 2016 at 20:07

Besides piping the file to a remote cat, you may also be able to use some SFTP client to transfer the files.

  • +1 but it should be noted that the OP is attempting to avoid scp because it does not exist on the systems. Given this constraint it's also probable that an FTP server needs to exist on the receiving end which makes the copying process dependent on software other than what is usually there by default.
    – Paul Sasik
    May 5, 2015 at 16:50

python3 -m http.server in the same directory with desired file - after that you can curl or wget or download a file with your browser. Note that with that running command all your files from current directory will be publicly available, until you press Ctrl+C.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .