> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transferring files using SCP (Secure Copy)

> Secure Copy (SCP) is a quick and secure way to transfer files to and from your hosting.com account by using the command line. Learn how to use SCP here.

This article describes how to use SCP (Secure Copy Protocol) to transfer files quickly and securely from the command line.

## What is SCP?

Secure Copy (SCP) is a protocol based on SSH (Secure Shell) that provides secure file transfers between two computers. With SCP, you can quickly transfer files using the command line, which is often faster and easier than using a client with a graphical interface. Additionally, you can use this command-line functionality in your own batch files and scripts to automate file transfers.

<Note>
  For information about how to securely transfer files using a client with a graphical interface, please see [this article](/docs/using-ftp-file-transfer-protocol).
</Note>

## Using an SCP client

Follow the appropriate procedure below for your computer's operating system to use SCP.

### Windows operating systems

Microsoft Windows does not include an SCP client, so you must download one first. hosting.com recommends PSCP, a free program that you can [download here](http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe).

<Note>
  PSCP is part of the PuTTY tool suite for Windows. For information about how to access your account using SSH and PuTTY, please see [this article](/docs/using-ssh-secure-shell).
</Note>

After you have downloaded the PSCP executable to your local computer, you should add the directory where pscp.exe is located to your path so you can run it from any directory. After you do this, you are ready to transfer files to and from your hosting.com account. To do this, follow these steps:

1. Open a DOS command window. To do this, click **Start**, click **Run**, type `cmd`, and then press Enter.

2. To upload a file to your hosting.com account, type the following command. Replace both occurrences of *username* with your hosting.com username, and *example.com* with your site's domain name. Additionally, replace *file* with the name of the file on your local computer that you want to upload, and replace *destination* with the destination directory on your hosting.com account:

   ```bash theme={null}
   pscp file username@example.com:/home/username/destination
   ```

   > 📘 Note
   >
   > To use a different port number, use the **-P** option. Make sure you use an uppercase **P** to specify the **SCP port** number. For example:
   >
   > ```
   > pscp -P 7822 file username@example.com:~/destination
   > ```

3. Type your password when you are prompted to do so. PSCP uploads the file to the destination directory that you specified.

4. To download a file from your hosting.com account, type the following command. Replace both occurrences of*username* with your hosting.com username, and *example.com* with your site's domain name. Additionally, replace *file* with the name of the file on your hosting.com account that you want to download, and replace *destination* with the destination directory on your local computer:

   ```bash theme={null}
   pscp username@example.com:/home/username/file destination
   ```

   > 👍 Tip
   >
   > To download the file to the current directory, type a period (**.** ) for the destination.

5. Type your password when you are prompted to do so. PSCP downloads the file to the destination directory that you specified.

   > 👍 Tip
   >
   > There are a few additional options that you may find useful when working with PSCP:
   >
   > * The **-p** option preserves the original file's attributes, such as modification and access times.
   >
   > * The **-r** option enables you to recursively copy entire directories. For example, if you want to download the entire  *public\_html* directory to the current directory on your local computer, type the following command:
   >
   > ```bash theme={null}
   > pscp -r username@example.com:/home/username/public_html.
   > ```
   >
   > * To view a list of all PSCP options, type `pscp` at the command line.

### macOS and Linux operating systems

Both macOS and Linux include the *scp* client program, so you do not have to download a special client. To use the scp program, follow these steps:

1. Open a terminal window. The procedure to do this depends on your operating system and desktop environment.

   * On macOS, click **Applications**, click **Utilities**, and then click **Terminal**.

2. To upload a file to your hosting.com account, type the following command. Replace *username* with your hosting.com username, and *example.com* with your site's domain name. Additionally, replace *file* with the name of the file on your local computer that you want to upload, and replace *destination* with the destination directory on your hosting.com account:

   ```bash theme={null}
   scp file username@example.com:~/destination
   ```

   > 📘 Note
   >
   > To use a different port number, use the **-P** option. For example:
   >
   > ```
   > scp -P 7822 file username@example.com:~/destination
   > ```
   >
   > Make sure you use an uppercase **P** to specify the **SCP port** number. Note that this is the opposite of the *ssh* client program, which uses a lowercase **p** to specify the **SCP port** number.

3. Type your password when you are prompted to do so. Scp uploads the file to the destination directory that you specified.

4. To download a file from your hosting.com account, type the following command. Replace *username* with your hosting.com username, and *example.com* with your site's domain name. Additionally, replace *file* with the name of the file on your hosting.com account that you want to download, and replace *destination* with the destination directory on your local computer:

   ```bash theme={null}
   scp username@example.com:~/file destination
   ```

   > 👍 Tip
   >
   > To download the file to the current directory, type a period (**.**) for the destination.

5. Type your password when you are prompted to do so. Scp downloads the file to the destination directory that you specified.

   > 👍 Tip
   >
   > There are a few additional options that you may find useful when working with scp:
   >
   > * The **-p** option preserves the original file's attributes, such as modification and access times.
   >
   > * The **-r** option enables you to recursively copy entire directories. For example, if you want to download the entire *public\_html* directory to the current directory on your local computer, type the following command:
   >
   > ```bash theme={null}
   > scp -r username@example.com:~/public_html.
   > ```
   >
   > * To view the complete scp documentation, type `man scp` at the command line.

## More information

For more information about SCP, please visit [http://en.wikipedia.org/wiki/Secure\_copy](https://en.wikipedia.org/wiki/Secure_copy).

## Related articles

* [Using SSH (Secure Shell)](/docs/using-ssh-secure-shell)

* [Using FTP (File Transfer Protocol)](/docs/using-ftp-file-transfer-protocol)
