Skip to content

Using scp in Linux Commands

Published: at 12:00 AMSuggest Changes

Table of Contents

Open Table of Contents

Introduction

The scp command is used for securely transferring files between hosts in a network. It uses SSH for data transfer, ensuring that the data is encrypted.

Basic Usage of scp

Syntax

The basic syntax of scp is:

scp [options] source destination

Example

To copy a file from a local machine to a remote server:

scp file.txt user@remote:/path/to/destination

Advanced scp Options

Recursive Copy

Use the -r option to copy directories recursively.

Specifying Ports

You can specify a port using the -P option.

Conclusion

Mastering the scp command is essential for secure file transfers in Linux environments.


Previous Post
Removing Directories with rmdir in Linux
Next Post
Automating Tasks with Linux Shell Scripts