> ## Documentation Index
> Fetch the complete documentation index at: https://www.0101isnothacking.nl/llms.txt
> Use this file to discover all available pages before exploring further.

# Linux file transfer

> Transfer files between Linux systems during security assessments using Wget, curl, SCP, and scripting languages.

## Introduction

File transfer is an essential skill in system administration, penetration testing, and cybersecurity. During security assessments, files often need to move between Linux systems to exchange tools, scripts, logs, and other resources.

This page covers common methods for transferring files on **Linux**, including Wget, curl, SSH/SCP, and one-liners in several programming languages, plus uploading over SSH and a web interface.

> [!WARNING]
>
> Only use these techniques against systems you own or have explicit authorization to test. Practise in authorized lab environments.

## Download methods

### Wget and curl

```sh theme={null}
wget url -O /file_name
curl -o file_name url
```

### Execute without downloading

Pipe a remote file straight into an interpreter instead of saving it to disk:

```sh theme={null}
curl url | bash
wget -qO- url | python3
```

### SSH (SCP)

```sh theme={null}
scp username@ip:/root/myroot.txt .
```

### Programming language one-liners

Useful when common download tools are unavailable on the target.

```sh theme={null}
# Python 2.7
python2.7 -c 'import urllib;urllib.urlretrieve("URL/file", "File_name")'

# Python 3
python3 -c 'import urllib.request;urllib.request.urlretrieve("URL/file", "File_name")'

# PHP
php -r '$file = file_get_contents("URL/file"); file_put_contents("File_name", $file);'

# Ruby
ruby -e 'require "net/http"; File.write("file_name", Net::HTTP.get(URI.parse("URL/file")))'

# Perl
perl -e 'use LWP::Simple; getstore("URL/file", "file_name");'
```

## Upload methods

### SSH (SCP)

```sh theme={null}
scp /file_to_upload username@ip:/path_to_save
```

### Web interface

**1. Install uploadserver on Linux**

```sh theme={null}
sudo /venv/bin/pip3 install uploadserver
```

**2. Start the server**

```sh theme={null}
sudo /venv/bin/python3 -m uploadserver
```

**3. Upload the file**

Open the web interface and upload the file: `http://ip:port/upload`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.