> For the complete documentation index, see [llms.txt](https://wiki.dmmax.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.dmmax.me/ssh/scp.md).

# SCP

## Syntax

```bash
scp [OPTION] [user@]SRC:]file1 [user@]DEST:]file2
```

where is

* OPTION – options which accept the command: ssh configuration, recursively, etc
* SRC – is a source source host
* DEST – is a destination host

## SCP copy local file to remote system

### SCP copy local file to remote with output path

```bash
scp /mnt/test/test.txt ubuntu@10.130.10.10:/home/ubuntu/test_folder/myfile.txt
```

This command will copy `test.txt` to the remote file, you could provide another name filename for remote system

### SCP copy local file under remote folder

```bash
scp /mnt/test/test.txt ubuntu@10.130.10.10:/home/ubuntu/test_folder
```

This command will copy the `test.txt` under the `test_folder` on remote machine with the same filename as original

## SCP copy local folder to remote folder

```bash
scp /mnt/test ubuntu@10.130.10.10:/home/ubuntu/test_folder
```

All files from `/mnt/test` will be copied recursively under the `test_folder`

## SCP copy remote file to local system

```bash
scp ubuntu@10.130.10.10:/home/ubuntu/test_folder/myfile.txt /mnt/test/remote_file.txt
```

## SCP copy files between two remote systems

```bash
scp ec2-user@18.135.23.123:/opt/my_folder/test.txt ubuntu@10.130.10.10:/home/ubuntu/myfile.txt
```

## SCP options

* `-r` – copy recursively
* `-P` – specifying the SSH port (default: 22)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.dmmax.me/ssh/scp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
