Post

SCP Cheatsheet

scp is not a “move” funciton its a copy function so if you copy a file it needs to get copied to a file not a directory.

ensure port number is first when coping files

1
scp -P 48827 wp-content.zip user@ip:public/wp-content/

COPY FILE

Copy a local file to your remote server.

1
scp examplefile yourusername@yourserver:/home/yourusername/

COPY DIRECTORY

1
scp -r /local/directory/ username@to_host:/remote/directory/

OTHER EXAMPLES

Copy file from a remote host to local host scp example:

1
scp username@from_host:file.txt /local/directory/

COPY FILE LOCAL - HOST TO A REMOTE HOST SCP EXAMPLE:

1
scp file.txt username@to_host:/remote/directory/

COPY DIRECTORY - REMOTE HOST TO LOCAL HOST SCP EXAMPLE:

1
scp -r username@from_host:/remote/directory/ /local/directory/

COPY DIRECTORY - LOCAL HOST TO A REMOTE HOST SCP EXAMPLE:

1
scp -r /local/directory/ username@to_host:/remote/directory/

COPY FILE - REMOTE HOST TO REMOTE HOST SCP EXAMPLE:

1
scp username@from_host:/remote/directory/file.txt username@to_host:/remote/directory/

Copy just the file type

1
scp -r user@yourserver:/var/www/your.site/public_html/\*.php .

Copy multiple file types

1
scp 192.168.1.2:/srv/myfiles/\{_.tar.gz,_.war\} .
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.