Skip to main content

SCP Utility To Transfer Files Between Linux Servers

 Introduction:

Transferring files betweenLinux servers is a common task for system administrators and developers. One of the most efficient and secure ways to accomplish this is by using the SCP (Secure Copy Protocol) command. In this guide, we'll walk you through the process of using SCP to transfer files from one server to another, complete with the necessary syntax and examples.

Prerequisites:
Before we delve into the SCP commands, make sure you have the following:

  1. Access to the source and target servers.
  2. Basic familiarity with the Linux command line.
  3. Knowledge of the file's location on the source server.

Syntax of SCP Command:
The basic syntax for using the SCP command is as follows:

scp [options] source destination

source: Specifies the path of the file or directory you want to copy.
destination: Specifies the target location where the file or directory will be copied.

Examples:

  1. Copy a File from Local Server to Remote Server:
    To copy a file named example.txt from the local server to a remote server at IP address remote_ip, use the following command:
scp example.txt username@remote_ip:/path/to/destination

Replace username with your remote server's username and /path/to/destination with the desired directory path on the remote server.

  1. Copy a File from Remote Server to Local Server:
    To copy a file named example.txt from a remote server to your local server, use the following command:
scp username@remote_ip:/path/to/source/example.txt /path/to/destination

Replace /path/to/source/example.txt with the actual path of the file on the remote server and /path/to/destination with the desired local directory.

  1. Copy a Directory from Local Server to Remote Server:
    To copy an entire directory named folder from the local server to a remote server, use the -r option to enable recursive copying:
scp -r folder username@remote_ip:/path/to/destination
  1. Copy a Directory from Remote Server to Local Server:
    To copy an entire directory named folder from a remote server to the local server, again use the -r option:
scp -r username@remote_ip:/path/to/source/folder /path/to/destination

Additional Options:

-P port: Specify a non-default SSH port for the SCP connection.
-i identity_file: Use a specific private key file for authentication.
-C: Enable compression during data transfer to speed up the process.
-v: Increase verbosity to view detailed progress.

Conclusion:
The SCP Linux command is a powerful tool for securely transferring files between Linux servers. Whether you need to copy individual files or entire directories, SCP provides a straightforward syntax and various options to customize the transfer process according to your needs. By following the examples and guidelines in this guide, you'll be able to confidently use SCP for your file transfer requirements. www.infoinflux.com

Comments

Popular posts from this blog

Upgrade Oracle Database 12c to 19c by DBUA Method

  Introduction Upgrade Oracle Database is a crucial step to ensure you're benefiting from the latest features, performance enhancements, and security updates. In this guide, we'll walk you through the process of upgrading your Oracle Database 12c to the latest version, 19c . Follow these steps to ensure a smooth and successful upgrade Environment Hostname : prod.infoinflux.com Database Name : PROD DB VERSION : 12.2.0.1.0 ORACLE_BASE : /u01/app/oracle DB Home Path : /u01/app/oracle/product/12.2.0.1/db_1 Datafile Location : /u01/app/oracle/oradata/PROD Target DB VERSION : 19.0.0.0 Target DB Path : /u01/app/oracle/product/19c/db_1 Upgrade Method : Database Upgrade Assistant Steps For upgrade using Database Upgrade Assistant (DBUA): Take Latest Database backup Make Directory for 19c Home Download and Unzip Software to 19c Home Directory Install 19c Binary or Software Create Pre and Post Upgrade Scripts Run Pre-Upgrade Script Pre-Upgra...

ORA-12012: error on auto execute of job SYS.ORA$AT_OS_OPT_SY_**

  Introduction ORA-12012 error is related to Oracle Database and is part of the Oracle Job Scheduler (DBMS_SCHEDULER) . It usually occurs when an automatic task or job execution encounters an issue. The error message you're seeing, " ORA$AT_OS_OPT_SY_<number> ," is specific to the job causing the problem. During the 12c database creation process, you can see ORA-12012 error in the alert log file when the “ SYS.ORA$AT_OS_OPT_SY_ ” auto job runs. To fix the error, it is necessary to drop the job and recreate it. Errors will be as follows. Errors in file /u01/app/oracle/diag/rdbms/prod/PROD/trace/PROD_j000_14524.trc: ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_767" ORA-20001: Statistics Advisor: Invalid task name for the current user ORA-06512: at "SYS.DBMS_STATS", line 47207 ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882 ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059 ORA-065...

Install Oracle Database 12.2(12c) on Linux

  Introduction Installing Oracle Database 12.2 on Linux system might seem daunting at first, but with the right guidance, it can be a smooth process. In this guide, we'll take you through the step-by-step procedure to install Oracle Database on a Linux environment. By the end of this tutorial, you'll have a functional Oracle Database instance up and running. Steps for Installation: 1. Prerequisites Automatic Setup 2. Prerequisites Manual Setup 3. Install Oracle Database Binary (Software only) 4. Create Database by DBCA 1. Prerequisites Automatic Setup To perform all your prerequisite setup automatically, issue the following command or you can proceed with manual setup explained in 2nd point. [ root @ prod ] # yum install oracle - database - server - 12cR2 - preinstall - y 2. Prerequisites Manual Setup a) Download and Unzip the oracle 12.2 Setup Download or copy the oracle setup file to any location as per your requirement. In...