Daan Beverdam

Developer and tech enthusiast with a background in artificial intelligence and neuropsychology.

Sending files over ssh without scp

Sending files over ssh without scp

Sometimes I get into the situation were I want to transfer a file to a remote server but I can't use the scp command. For these situations, I've learned a simple way to send and retrieve files using only cat and ssh.

Send files

To send a file to a remote server, you can use:

cat file | ssh [email protected] "cat > file"

This line uses cat to read the contents of file on the local machine and pipes the output to the ssh command which then redirects it to file on the remote server.

Retrieve files

To retrieve a file from a remote server, you can use:

ssh [email protected] "cat file" > file

This line uses cat to read the contents of file on the remote server and redirects the output to file on the local machine.