Linux scp命令

Linux scp命令 | 菜鸟教程 (runoob.com)

Linux scp命令用于Linux之间复制文件和目录。

scp:secure copy的缩写,scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令。

scp是加密的,rcp是不加密的。

语法:

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]

-l limit\] \[-o ssh_option\] \[-P port\] \[-S program

\[user@\]host1:\]file1 \[...\] \[\[user@\]host2:\]file2

参数说明:

-1 :强制scp命令使用协议ssh1

-2:强制scp命令使用协议ssh2

-4:强制scp命令只使用IPv4寻址

-6:强制scp命令使用协议ssh2

-B: 使用批处理模式(传输过程中不询问传输口令或短语)

-C: 允许压缩。(将-C标志传递给ssh,从而打开压缩功能)

-p:保留原文件的修改时间,访问时间和访问权限。

-q: 不显示传输进度条。

-r: 递归复制整个目录。

简易写法:

scp [可选参数] file_source file_target

我使用比较多的是:

从本地复制到远程

scp local_file remote_username@remote_ip:remote_folder

或者

scp local_file remote_username@remote_ip:remote_file

或者

scp local_file remote_ip:remote_folder

或者

scp local_file remote_ip:remote_file

第1,2个指定了用户名,命令执行之后需要再输入密码,第一个仅指定了远程的目录,文件名称不变,第2个指定了文件名。

第3,4个没有指定用户名,命令执行后需要输入用户名和密码。

Linux cp 命令 | 菜鸟教程 (runoob.com)

相关推荐
文静小土豆15 分钟前
CentOS 7 OpenSSH 10.2p1 升级全攻略(含离线安装与回退方案)
linux·运维·centos·ssh
五阿哥永琪31 分钟前
进程的调度算法
linux·运维·服务器
小杜的生信筆記34 分钟前
生信技能技巧小知识,Linux多线程压缩/解压工具
linux·数据库·redis
nzxzn34 分钟前
LVS(Linux virual server)知识点
linux·运维·lvs
菜鸟别浪37 分钟前
内存管理-第1章-Linux 内核内存管理概述
linux·运维·云计算·虚拟化·内存管理
nxb5561 小时前
云原生keepalived实验设定
linux·运维·云原生
luoshanxuli20101 小时前
Linux UVC Camera的介绍与实践应用(二)
linux
xianyudx1 小时前
Linux 服务器 DNS 配置指南 (CentOS 7 / 麒麟 V10)
linux·服务器·centos
grrrr_11 小时前
【Linux】内网穿透 FTP 终极复现手册 (2026 版)--cpolar
linux·网络·内网穿透·ftp·cpolar
文静小土豆2 小时前
CentOS 7 升级 OpenSSL 3.5.4 详细指南
linux·运维·centos·ssl