Linux Commands Helper
💬 Your AI-powered Linux assistant
scp Command - Secure Copy (Remote File Copy Program)
The scp command is used to securely copy files and directories between hosts on a network. It uses SSH for data transfer and provides the same authentication and security as SSH.
Syntax
scp [options] [[user@]host1:]file1 [[user@]host2:]file2
Examples
scp file.txt user@remote:/home/user/
Copy file.txt to a remote host.
scp -r dir/ user@remote:/home/user/
Recursively copy a directory to a remote host.
scp user@remote:/home/user/file.txt ./
Copy a file from a remote host to the local machine.
Notes
- scp uses SSH for data transfer and authentication.
- For large or resumed transfers, consider using
rsync
instead. - Some modern systems recommend
sftp
orrsync
over scp for security reasons.