Skip to content

Linux SCP Command Guide

Published: at 12:00 PMSuggest Changes

Linux SCP Command Guide

Introduction

SCP (Secure Copy Protocol) is a command-line utility used to securely transfer files between hosts on a network. It uses SSH for data transfer and provides the same authentication and security as SSH.

Usage

To copy files, use the following command:

scp [options] [source] [destination]

Common Options

Examples

  1. Copy a file to a remote server:

    scp localfile.txt [email protected]:/path/to/destination/
    
  2. Copy a file from a remote server:

    scp [email protected]:/path/to/remotefile.txt /local/destination/
    
  3. Recursively copy a directory to a remote server:

    scp -r localdir/ [email protected]:/path/to/destination/
    
  4. Specify a port for the connection:

    scp -P 2222 localfile.txt [email protected]:/path/to/destination/
    

Previous Post
Linux Curl Command Guide
Next Post
Linux SSH Command Guide