How to Install and Use croc in Linux to Securely Transfer Files Between Computers

Transferring files between computers across different local networks or over the internet is often frustratingly complicated. Setting up an SSH server requires port forwarding and firewall adjustments; cloud storage services enforce file size limits and synchronisation lag; and messaging apps compress media or require personal account logins on shared machines.

To eliminate this friction, developer communities created croc. Written in Go, croc is an open-source command-line tool that enables any two computers (running Linux, macOS, or Windows) to transfer files and directories directly, securely, and with zero configuration. By using peer-to-peer relay architecture protected by end-to-end PAKE encryption, croc requires only a simple temporary code phrase to initiate a transfer.

How croc Operates: Security and Architecture

Unlike unsecured transfer utilities, croc enforces industry-standard cryptographic safeguards by default:

  • End-to-End Encryption: Implements Password Authenticated Key Exchange (PAKE) using SPAKE2 to derive ephemeral session keys, followed by authenticated encryption via PGP/AES-GCM.
  • NAT Traversal & Relay Routing: Traverses firewalls, symmetric NATs, and private subnets automatically using STUN/relay fallbacks, allowing computers on different continents to connect effortlessly.
  • Automatic Resumption: If a network drop occurs mid-transfer, croc verifies existing block hashes and resumes transmission from the exact byte where it paused.
  • Directory Support: Recursively packages and streams complete directory trees without requiring manual tar or zip compression beforehand.

Installing croc on Ubuntu and Linux

You can install croc using several convenient distribution methods:

Method 1: Direct Installation Script (Official)

Open your terminal (Ctrl + Alt + T) and run the maintainer’s one-line installer:

curl https://getcroc.schollz.com | bash

Method 2: Installation via Snap

On Ubuntu systems with Snap support enabled:

sudo snap install croc

Method 3: Package Managers (Homebrew / Cargo)

If you use Homebrew on Linux or macOS:

brew install croc

Sending a File from Linux

Transmitting a file or an entire directory requires a single intuitive command:

croc send sample-video.mp4

To send an entire project directory containing thousands of source code files:

croc send ~/Projects/my-app/

When you execute the command, croc connects to an encrypted public relay, computes the block hashes, and outputs an auto-generated four-word code phrase. For example:

Sending 'sample-video.mp4' (450.2 MB)
Code is: 4892-lemon-bravo-pluto
On the other computer, please run:

croc 4892-lemon-bravo-pluto

Receiving the File on Another Computer

On the destination computer (which can be another Linux desktop, a MacBook, or a Windows PC with croc installed):

  1. Open the terminal or command prompt.
  2. Execute croc followed by the exact code phrase:
    croc 4892-lemon-bravo-pluto
  3. croc displays the sender’s IP address, the filename, and the total transfer size.
  4. Type y and press Enter to accept the incoming transfer.
  5. A real-time progress bar shows transfer speed and estimated time remaining. Once finished, the file is saved into your current active working directory.

Using Custom Code Phrases

If communicating a randomised four-word string is inconvenient, specify your own memorable passphrase using the --code flag:

croc send --code meeting-report-2026 report.pdf

The recipient simply runs croc meeting-report-2026 to retrieve the file.

Transferring Directly Over Local Wi-Fi (No Internet Relay)

If both computers are connected to the same local office or home Wi-Fi network and you want maximum gigabit transfer speeds without routing through an external relay, force local discovery:

croc --local send large-archive.tar.gz

croc broadcasts on your local subnet to establish a direct local socket connection, saturating your full local network bandwidth.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.