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)

相关推荐
峥嵘life10 分钟前
Android 16 EDLA测试STS模块
android·大数据·linux·学习
代码AC不AC28 分钟前
【Linux】进程程序替换
linux·进程·程序替换
Zach_yuan30 分钟前
UDP网络编程:从入门到精通
linux·网络·网络协议·udp
_叶小格_43 分钟前
cp、scp、rsync命令详解
linux·运维·服务器·ubuntu·centos·运维开发
wheeldown1 小时前
【Linux网络编程】 Linux TCP网络编程:客户端开发+守护进程实战
linux·网络·tcp/ip
永不复还1 小时前
linux 使用Xcb监听键盘鼠标输入
linux·x11·xcb
mango_mangojuice1 小时前
Linux学习笔记 1.19
linux·服务器·数据库·笔记·学习
i建模1 小时前
linux断点续传下载文件
linux·运维·服务器
木卫二号Coding2 小时前
Docker-构建自己的Web-Linux系统-Ubuntu:22.04
linux·前端·docker
小天源2 小时前
CentOS 7介绍及其下载
linux·运维·ubuntu·centos·麒麟·windows11·windows10