Transfer files remotely has for a long time been a reserve of rsync and SCP protocols. In this article, we will take a look at how you can transfer files between Linux computers using dcp tool. dcp tool is a handy tool that copies files between host machines in a network using the DAT network. In this guide, we will try to remotely copy files between two Ubuntu/Debian Systems.
We are going to demonstrate the remote copying of files using two Debian hosts:
- Host A - IP 10.200.50.50 ( This system will host files to be sent remotely to another host system)
- Host B - IP 10.200.50.51 (This will be the System where files will be transferred/copied to)
How dcp works
Dcp tool creates a dat archive for a specified group of files or directories. Using a generated public key, dcp allows you to download the said archive from the second host system. Data shared over the network is encrypted using the archive's public key, so you don't need to worry about the security of your data. Data will only be limited to those who have access to the key.
To successfully install the dcp tool, the following software packages are required on both host systems
To install NodeJS, we are going to add Node.js PPA to our host machines. The PPA is provided by the Official Nodejs website. In addition, we are going to install the software-properties-common package.
Log in to each of the systems and follow the steps below
Install software-properties-common package
Run the command below
# sudo apt-get install curl software-properties-common
Next, Add the required PPA file to allow you to install Node.JS
Run the command below to add PPA
# curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
Finally, let's install the Node.JS package which will also come with NPM
Install Node.JS package
# sudo apt-get install -y nodejs
Verifying installation of Node.JS and NPM
To verify installation of Node.JS
# node -v
To verify installation of NPM
# npm -v
Now that we have our software prerequisites, let's proceed and install dcp
Install dcp tool
To install the dcp tool run
npm i -g dat-cp
To verify that all went OK, let's check out the version of the dcp tool
Great! Let's create a few files on our source system and try and send them over the network to the second host.
# touch file1.txt file2.txt file3.txt
How to remotely transfer/copy files
To remotely copy the files to another host , run the following command
dcp file1.txt file2.txt file3.txt
This will generate a public key at the bottom as shown in cyan color.
Copy the key and paste it on the remote server as shown
Congratulations! You have successfully copied files from one host to another using the dcp tool.
To find more information about the tool's usage run
That's it for today guys. I hope you found this guide helpful. Feel free to comment and share. Thanks!
- 12 Common Linux Rsync Command Options in Linux with Examples
- 10 Linux rsync Examples to Exclude Files/Directories
- How to Use SCP Command for A File/Directory Transfer in Linux