How to Install and Use croc to Securely Transfer Files on Linux – MUO – MakeUseOf

Want to share files with other devices using the Linux command line? Check out croc, an easy-to-use cross-platform file transfer utility for Linux.
Transferring files between computers is a relatively straightforward act if you have the right tool. While most file transfer tools work the same and share a similar feature set, a few stand out with their distinctive features.
Croc is one such tool. It works via the command line and lets you transfer files and folders between computers quickly and securely.
Follow along as we discuss croc and list down the instructions to use it for transferring files between Linux and any other device.
Croc is a cross-platform file transferring tool that allows you to share files and folders between two computers in a quick and secure manner. It works through the command line and is compatible with all major computer platforms: Linux, macOS, and Windows.
One aspect of croc that separates it from other file-sharing tools is how it handles data transfers. For starters, croc uses a relay server—instead of uploading files to a server, unlike other tools—to create a full-duplex communication layer between the two computers for transferring data. As a result, it's much quicker and doesn't require port forwarding to transmit files.
Similarly, croc employs the PAKE (Password Authenticated Key Exchange) cryptography method to ensure your transferred data remains secure, which is something you usually don't find on other file transfer utilities.
Below are some of the standout features of croc that distinguish it from other cross-platform file sharing tools:
Related: How to Install Docker on Ubuntu Linux
Croc works on all major Linux distros, and you can install it on your computer using the following steps.
First, download the latest release of croc for your system from the link below.
Download: Croc
To install the DEB package on Ubuntu/Debian, first, launch the terminal. Then, navigate to the directory where you've downloaded the file and type in the following command:
Alternatively, if you're on Arch Linux, you can install croc by running:
Similarly, to install it on FreeBSD, use:
If you can't find an installer for your distro, issue the following command to download and execute the installation script:
Since croc facilitates file transfer between two computers, it goes without saying that you also need to have croc installed on the other device. Head over to croc's GitHub to find out instructions on how to install it on your device.
With croc installed on your computers, you can now use it to do both: share files and receive files. So depending on your use case, follow the instructions below to transfer files from/to your Linux computer.
For situations where you want to transfer files from your Linux machine to some other computer (running another operating system), follow the steps below to carry out the send operation in croc.
Since the entire operation in croc takes place through the command line, make sure you have it opened on both your computers. Then, on your sending device, which is your Linux machine in this case, type the following command in the terminal and hit Enter:
For example:
As soon as you do that, you'll see a code right below the Sending message. This code is what will allow you to receive the files on another computer.
Go back to the command prompt on the receiving computer and enter the command using the syntax below:
For instance, if your code is alpha1, you'd need to enter:
Enter y to accept the incoming file and download it to your device.
Once the code matches on both machines, a PAKE is established and the transfer begins. In addition, the program also generates a secret key for end-to-end encrypted data transfer between both parties.
Although croc's random code phrases do the job, they can sometimes be too long to type. As an alternative, you can generate a custom code yourself when initiating the transfer. For this, modify the command syntax as shown below:
Similar to sending files, croc also allows you to send text, which can come in handy when you want to share a message or a URL. Use the following syntax to send a text via croc:
For example:
On the receiving device, enter the code phrase generated by the above command and hit y, when prompted, to view the message.
Much like sharing files from your Linux computer, there might be times when you'd want to receive files from another device to your Linux machine.
In such situations, you can simply reverse the process, as demonstrated in the steps below.
On the sending machine, open the command line and run:
Go back to your Linux machine, and in the terminal window, enter:
Again, enter y to accept the file.
Most file transferring apps offer cross-platform functionality these days. However, what separates croc from the rest is its ease-of-use, quick and secure nature that facilitates file transfers between computers running different operating systems.
In fact, croc is said to be the only CLI-based file transferring tool with such an extensive feature set, making it a perfect file transfer companion for those who prefer working through the command line.
Having said that, you can also check out qrcp, a free file transfer utility that uses QR codes to help you transfer files between Linux, Android, and iOS.
Yash is a Staff Writer at MUO for DIY, Linux, Programming, and Security. Before finding his passion in writing, he used to develop for the web and iOS. You can also find his writing on TechPP, where he covers other verticals. Other than tech, he enjoys talking about astronomy, Formula 1, and watches.
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!


Compare items
  • Total (0)