# Sharing files on Linux

This guide provides the information you need to start sharing files over Meshnet on Linux.

## Before you begin

Make sure that the device you want to share files with meets the following criteria:

* The NordVPN app is running, and the Meshnet feature is enabled in the app.
* The device is connected to your Meshnet.&#x20;

{% hint style="info" %}
**Note**

You can add devices to your Meshnet in two ways, depending on device ownership:

* To add your own device, just enable Meshnet on that device. See [Using Meshnet on Linux](https://meshnet.nordvpn.com/getting-started/how-to-start-using-meshnet/using-meshnet-on-linux#add-your-own-devices) for details.
* To add an external device, send an invitation via the NordVPN app with the owner's email. Ensure the invitation is accepted. See [Adding external Meshnet devices on Linux](https://meshnet.nordvpn.com/features/linking-devices-in-meshnet/adding-external-meshnet-devices-on-linux).
  {% endhint %}

## Send files <a href="#sharingfilesovermeshnetonlinux-sendfiles" id="sharingfilesovermeshnetonlinux-sendfiles"></a>

You can initiate a file transfer from the [NordVPN](https://nordvpn.com/download/linux/) app by completing these steps:

1. Open **Terminal**.
2. Enter the `nordvpn meshnet peer list` command and copy the Nord name or Meshnet IP address of the device you want to share your files with.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fv5LXSTbz6eZMRO4QhNq5%2Flinux_peer_name_everest.png?alt=media&#x26;token=24c50885-71c9-4f35-a13b-e76d8f3b7f6f" alt="Nord name of a peer device highlighted in the terminal."><figcaption></figcaption></figure></div>

   &#x20;
3. Type the `nordvpn fileshare send` command, followed by your peer device’s Nord name or Meshnet IP address and the path to the file you want to transfer, as shown:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare send &#x3C;peer> &#x3C;/path/to/your/file>
   </code></pre>

   &#x20;\
   You can use the absolute and the relative [file paths](https://www.redhat.com/sysadmin/linux-path-absolute-relative) for the files you want to send.\
   &#x20;\
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FPZTEsMBqTScP7w8I7Txn%2Flinux_send_file.png?alt=media&#x26;token=ff338dc3-1b2a-4d4c-8c1a-b700dbf10c97" alt="The &#x22;Waiting for the peer to accept your transfer&#x22; message is displayed in the terminal"><figcaption></figcaption></figure></div>

   &#x20;
4. To add additional files to the transfer, append the path of the new file to the already entered command. You can drag files from the file explorer to the terminal to paste their path.\
   &#x20;\
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FEC8TludbaaxlLHGi3ib7%2Flinux_send_multiple.png?alt=media&#x26;token=df67cf34-4bac-4a1f-995b-6d8197ccb39f" alt="Two file paths are displayed next to the &#x27;nordvpn fileshare send&#x27; command in the terminal"><figcaption></figcaption></figure></div>

{% hint style="success" %}
**Tip**

To find your peer's Nord name faster, start typing the name and press **Tab**. The system will auto-complete the name with a match from online devices.
{% endhint %}

{% hint style="info" %}
**Note**

You can only send files to the devices that have the file sharing permission enabled for your device. For more information, see [File sharing permissions](https://meshnet.nordvpn.com/features/explaining-permissions/file-sharing-permissions).
{% endhint %}

The file transfer begins when the recipient accepts your download request on their device. For details, consult the appropriate guides:

* [Receive shared files on Windows](https://meshnet.nordvpn.com/features/sharing-files-windows#sharingfilesovermeshnetonwindows-receivesharedfiles)
* [Receive shared files on Android](https://meshnet.nordvpn.com/features/sharing-files-android#sharingfilesovermeshnetonandroid-receivesharedfiles)
* [Receive shared files on iPhone/iPad](https://meshnet.nordvpn.com/features/sharing-files-ios#sharingfilesovermeshnetonios-receivesharedfiles)
* [Receive shared files on macOS](https://meshnet.nordvpn.com/features/sharing-files-macos#sharingfilesovermeshnetonmacos-receivesharedfiles)
* [Receive shared files on Linux](#sharingfilesovermeshnetonlinux-receivesharedfiles)
* [Receive shared files on Android TV](https://meshnet.nordvpn.com/features/sharing-files-androidtv#receive-shared-files)

### Viewing outgoing transfer history

To display the history of transfers sent from your device, along with their ID, size, status, and other relevant details, use the following command:

{% code overflow="wrap" %}

```bash
nordvpn fileshare list --outgoing
```

{% endcode %}

The transfers in the list are arranged in chronological order, with the oldest transfers appearing first.

## Receive shared files <a href="#sharingfilesovermeshnetonlinux-receivesharedfiles" id="sharingfilesovermeshnetonlinux-receivesharedfiles"></a>

{% hint style="info" %}
**Note**

Make sure that Meshnet is enabled on your device to receive the file transfer request from the sender.
{% endhint %}

You can use the NordVPN notifications or the command line to receive files shared from another linked device.

{% tabs %}
{% tab title="Accepting transfers using notifications" %}

1. Open **Terminal**.
2. Ensure that you have enabled the NordVPN notifications by running this command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn set notify on
   </code></pre>

   &#x20;
3. Have your Meshnet peer send the files.
4. Upon receiving the file transfer notification, select **Accept** within it to start the download of the transferred files.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F34c3utxfnr4mbVFslM6N%2Flinux_transfer_notif_accept_dark.png?alt=media&#x26;token=efc6178f-1499-417e-8fdf-dfd9383ba8ef" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F4gcsUbL2fEPbgW3OOsxp%2Flinux_transfer_notif_accept.png?alt=media&#x26;token=a0751eda-f762-4501-af01-44aa8f6fd118" alt="Clicking &#x27;Accept&#x27; in the NordVPN incoming file transfer notification."></picture><figcaption></figcaption></figure></div>

{% endtab %}

{% tab title="Accepting transfers using the command line" %}

1. Have your Meshnet peer send the files.
2. Open **Terminal**.
3. Enter the `nordvpn fileshare list` command followed by `--incoming` to display incoming requests, as shown:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare list --incoming
   </code></pre>

   &#x20;
4. Copy the ID of the file transfer request you want to accept.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fdlyo02DQNvIXFxAcYdGf%2Flinux_receive_list.png?alt=media&#x26;token=68cee065-7593-42b0-8eea-01f5f75e26e6" alt="Meshnet file transfer ID highlighted in the terminal"><figcaption></figcaption></figure></div>

   &#x20;
5. Type `nordvpn fileshare accept` followed by the file transfer ID from the previous step, as shown:​

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare accept &#x3C;id>
   </code></pre>

   &#x20;\
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FRlRUciCDGgFThjewng89%2Flinux_receive_accept.png?alt=media&#x26;token=f0d3c21b-558e-4ae4-8e37-de002b7687b3" alt="CLI showing the &#x22;nordvpn fileshare accept&#x22; command followed by the file transfer ID"><figcaption></figcaption></figure></div>

{% hint style="success" %}
**Tip**

The ID can be auto-completed. Start typing the initial characters of the ID and press **Tab** for quick suggestions.
{% endhint %}
{% endtab %}
{% endtabs %}

Once a download is complete, if you have NordVPN notifications enabled, you will receive a notification about each individual downloaded file.&#x20;

<div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FdsOxIi1vNKmKAkTEavDm%2Flinux_transfer_notif_finished_dark.png?alt=media&#x26;token=2631d7a5-dbbd-452c-b40f-9e2f2f9cb209" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F6S26v3m6lJ0fxJmpBQql%2Flinux_transfer_notif_finished.png?alt=media&#x26;token=934c8567-b139-48bd-a5ee-ec2cbb2bc857" alt="NordVPN notification informing about a downloaded file."></picture><figcaption></figcaption></figure></div>

You can find the files shared with you by checking the system's **Downloads** folde&#x72;*.*

If you want to download only specific files from the transfer, provide the names of the files you choose to accept.

{% code overflow="wrap" %}

```bash
nordvpn fileshare accept <id> <file1> <file2>...​
```

{% endcode %}

**Example**

<figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZYpCc1X0kIEvfoXALHPf%2Flinux_send_individual.png?alt=media&#x26;token=b64c2d30-cb51-44a6-a0c9-03a5037cc299" alt="CLI showing the &#x22;nordvpn fileshare accept <id>&#x22; command with two file names highlighted"><figcaption></figcaption></figure>

{% hint style="success" %}
**Tip**

To display the list of files in a particular transfer directory, enter the `nordvpn fileshare list` command followed by the transfer ID:

{% code overflow="wrap" %}

```bash
nordvpn fileshare list <id>
```

{% endcode %}
{% endhint %}

### **Accepting transfers automatically**

You can enable automatic transfer acceptance from a specific peer. To do this, run the following command, replacing `<device>` with the peer’s Nord name or Meshnet IP:

```bash
nordvpn meshnet peer auto-accept enable <device>
```

To learn more, see the [Changing permissions](https://meshnet.nordvpn.com/explaining-permissions/file-sharing-permissions#linux) section of the "File sharing permissions" page.

### Setting the download location&#x20;

By default, the downloaded files are saved in the `$HOME/Downloads`directory. However, if you want to specify a different location on your system, use the `--path` command option followed by the desired location and the transfer ID:

{% code overflow="wrap" %}

```bash
nordvpn fileshare accept --path </path/to/directory> <id>
```

{% endcode %}

## Run a transfer process in the background

If you want to run a transfer process in the background, use the `--background` option.

* When sending a file transfer, enter:

  <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare send --background &#x3C;peer> &#x3C;/path/to/your/file>
  </code></pre>

  &#x20;\
  **Example**

  <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F1Bdzss0qIpowSRixIg2v%2Flinux_send_background.png?alt=media&#x26;token=79cdfe19-3554-4407-91e5-131bc6dd69f1" alt="Terminal showing the &#x27;nordvpn fileshare send --background&#x27; command."><figcaption></figcaption></figure></div>

  &#x20;
* When accepting a file transfer, type:&#x20;

  <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare accept --background &#x3C;id>
  </code></pre>

## Manage transfers

<details>

<summary>Canceling file transfers</summary>

If you need to cancel a transfer while it is still in progress, there are two ways to do it:

* Use the **Ctrl** + **C** keyboard shortcut to terminate a file transfer when it's running in the foreground and you are using the same terminal session.
* Use the `cancel` command to stop transfers that are being performed in the background. This command allows you to cancel the whole transfer or a specific file within the transfer.
  * To cancel a file transfer, enter the following command, replacing `<id>` with the ID of the transfer you want to cancel.

    <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare cancel &#x3C;id>
    </code></pre>

    &#x20;\
    **Example**

    <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F5Uahw5xJS45UJunpbsA8%2Flinux_transfer_cancel.png?alt=media&#x26;token=e9040e56-eaa9-4afc-9d72-917b63c12253" alt="A message confirming the successful cancellation of a file transfer"><figcaption></figcaption></figure></div>

    &#x20;
  * To cancel a specific file in a transfer, provide the file's name following the transfer ID, as shown:

    <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare cancel &#x3C;id> &#x3C;file>
    </code></pre>

</details>

<details>

<summary>Clearing your transfer history</summary>

You can remove entries from your file sharing history by using the `clear` command.

* &#x20;To completely remove all of your transfer history, run the following command:

  <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare clear all
  </code></pre>

  &#x20;
* To clear transfer records older than a specific date, use the command below with the selected time interval in [SystemD time span syntax](https://www.freedesktop.org/software/systemd/man/latest/systemd.time.html):

  <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare clear &#x3C;time_interval>
  </code></pre>

  &#x20;\
  **Example**\
  This command will remove history entries that are older than one day and 12 hours.

  <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn fileshare clear 1d 12h
  </code></pre>

</details>

## &#x20;Display a help message <a href="#sharingfilesovermeshnetonlinux-seealso" id="sharingfilesovermeshnetonlinux-seealso"></a>

You can access command information using the `--help` option. For example, to view helpful information about the `fileshare` command, type:

{% code overflow="wrap" %}

```bash
nordvpn fileshare --help
```

{% endcode %}

## See also <a href="#sharingfilesovermeshnetonlinux-seealso" id="sharingfilesovermeshnetonlinux-seealso"></a>

* [Sharing files on Windows](https://meshnet.nordvpn.com/features/sharing-files-in-meshnet/sharing-files-windows)
* [Sharing files on Android](https://meshnet.nordvpn.com/features/sharing-files-in-meshnet/sharing-files-android)
* [Sharing files on iPhone/iPad](https://meshnet.nordvpn.com/features/sharing-files-in-meshnet/sharing-files-ios)
* [Sharing files on macOS](https://meshnet.nordvpn.com/features/sharing-files-in-meshnet/sharing-files-macos)
* [Sharing files on Android TV](https://meshnet.nordvpn.com/features/sharing-files-in-meshnet/sharing-files-androidtv)
