home
fun-with-scp.md

Fun with scp

2022-04-15

Not that scp but the linux scp :)

I never quite remember how to use scp so I figure I should write down the 3 most common things I do that scp would be helpful for.

Copying a file from somewhere else:

> scp user@some.ip.address:/path/to/file.txt ./

Copying a directory from somewhere else:

> scp -r user@some.ip.address:/path/to/folder ./

Coping a file from here to there:

> scp file.txt user@some.ip.address:/home/nivethan/temp

Coping a directory from here to there:

> scp -r folder user@some.ip.address:/home/nivethan/temp

You can use \-q to silence the messages but this also silences errors.

You can also use sshpass to automate the password entry.

> sshpass -p "password" scp user@some.ip.address:/path/to/file.txt ./