How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Transfer Files Between Two Computers using nc and pv Commands

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
29
VIEWS
Share on FacebookShare on Twitter

Contents

  1. How to Transfer Files Between Two Linux Machines?
    1. On Linux Machine A
    2. On Linux Machine B

Hi fellow Linux readers, I’m bringing you yet another great article from our Linux Tips and Tricks series, this time we will be using two lesser known Linux utilities that you should must know about.

This article will explain how do you transfer files between two Linux computers using nc (networking utility) and pv (pipe viewer) commands, before moving further let me explain what are these two commands.

How to Transfer Files Between Two Computers using nc and pv Commands

Transfer Files Between Linux Servers

nc stands for Netcat and often point out as “Swiss Army knife” is a networking tool used for network debugging and investigation and also it is used for creating network connections using TCP or UDP, port scanning, file transfer and more. It is created to be a dependable back-end and specially used in programs and scripts, since it can generate almost any kind of network connection and has a number of built-in features.

pv in short Pipe Viewer is a terminal based tool for monitoring progress of data send through a pipeline, it allows a user to see the progress of data with progress bar, shows time elapsed, percentage completed, current throughput rate, total data transferred, and Estimated Time to complete the process.

How to Monitor Progress of Data Using pv (Pipe Viewer) Command

Let’s now move further and see how we can combine both commands to transfer files between two Linux computers, for the purpose of this article we will be using two Linux machines as follows:

Machine A with IP : 192.168.0.4
Machine B with IP : 192.168.0.7

Note: I strongly advise not to use netcat to send and receive data over pubic network, as it doesn’t use any logins or authentication, the only requirement is the client IP and listening port number and the data send over network is not secured, thus, it always reserved for advanced Linux users and preferred to use on protected local network.

Situations where security of data is more important, then always use rsync over SSH or scp over SSH.

Now let’s start with some real easy example of nc and pv commands, but before doing that both utilities must installed on the system, if not install them using your respective distribution package manager tool as suggested:

# yum install netcat pv        [On RedHat based systems]
# dnf install netcat pv        [On Fedora 22+ versions]
# apt-get install netcat pv    [On Debian and its derivatives]

How to Transfer Files Between Two Linux Machines?

Let’s assume that you want to send one large file called CentOS-7-x86_64-DVD-1503.iso from computer A to B over network, the quickest way to achieve this using nc a network utility used to send files over TCP network, pv to monitor the progress of data and tar utility to compress data to improve transfer speed.

On Linux Machine A

First login into the machine ‘A‘ with IP address 192.168.0.4 and run the following command.

# tar -zcf - CentOS-7-x86_64-DVD-1503.iso | pv | nc -l -p 5555 -q 5
How to Transfer Files Between Two Computers using nc and pv Commands

Netcat Command To Send Files

Let me explain the options used in above command:

  1. tar -zcf = tar is a tape archive utility used to compress/uncompress archive files and arguments -c creates a new .tar archive file, -f specify type of the archive file and -z filter archive through gzip.
  2. CentOS-7-x86_64-DVD-1503.iso = Specify the file name to send over network, it can be file or path to a directory.
  3. pv = Pipe Viewer to monitor progress of data.
  4. nc -l -p 5555 -q 5 = Networking tool used for send and receive data over tcp and arguments -l used to listen for an incoming connection, -p 555 specifies the source port to use and -q 5 waits the number of seconds and then quit.

On Linux Machine B

Now login into machine ‘B‘ with IP address 192.168.0.7 and run the following command.

# nc 192.168.1.4 5555 | pv | tar -zxf -
How to Transfer Files Between Two Computers using nc and pv Commands

Transfer Data Using nc and pv command

That’s it, the file gets transferred to computer B, and you’ll be able to watch how quick the operation was performing. There are tons of more other great usage of nc (not covered yet, but will write about it soon) and pv (we already covered a detail article on this here) commands, if you know any example, please let us know via comments!

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install Apache Tomcat 8 on CentOS 7
Linux

How to Install Apache Tomcat 8 on CentOS 7?

February 11, 2020
Install Arch Linux With Btrfs Snapshotting
Uncategorized

Install Arch Linux With Btrfs Snapshotting

February 13, 2020
Next Post
Bash ShellShock – The Best Ways to Check if You Are Vulnerable.

Bash ShellShock – The Best Ways to Check if You Are Vulnerable.

How to Configure a Firewall with UFW

How to Configure a Firewall with UFW

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

How to Install a Jenkins Automation Server on Ubuntu 18.04

How to Install a Jenkins Automation Server on Ubuntu 18.04

4 years ago

How to Find and Remove Duplicate/Unwanted Files in Linux Using ‘FSlint’ Tool

4 years ago

Install Lynis on Debian 8

3 years ago

How to Install Subrion 4.1 CMS on a Fedora 26 LAMP VPS

3 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.