linux文件操作
Posted chendeming
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux文件操作相关的知识,希望对你有一定的参考价值。
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides
the same securityas ssh(1).
scp will ask for passwords or passphrases if they are needed for authentication.
File names may contain a user and host specification to indicate that the file is to be copied to/from that host.
Local file names can be made explicit using absolute or relative pathnames to avoid scp treating
file names containing `:‘ as host specifiers. Copies between two remote hosts are also permitted.
个人解读:
(1)scp通过网络在多个主机间拷贝文件(不一定是远端拷贝到本地)
(2)使用ssh工具的1版本协议做数据传输
(3)要账号和密码认证
(4)包含:就算远端机器
常用例子:
(1)远程拷贝到本地
scp [email protected]:/usr/local/sin.sh /home/administrator
remote 通过remote用户登录到远程服务器(也可以使用其他拥有同等权限的用户)
www.abc.com 远程服务器的域名(当然也可以使用该服务器ip地址)
/usr/local/sin.sh 欲复制到本机的位于远程服务器上的文件
/home/administrator 将远程文件复制到本地的绝对路径
(2)本地拷贝到服务器
scp /home/administrator/news.txt [email protected]:/etc/squid
/home/administrator/ 本地文件的绝对路径
news.txt 要复制到服务器上的本地文件
root 通过root用户登录到远程服务器(也可以使用其他拥有同等权限的用户)
192.168.6.129 远程服务器的ip地址(也可以使用域名或机器名)
/etc/squid 将本地文件复制到位于远程服务器上的路径
备注:
1.如果远程服务器防火墙有特殊限制,scp便要走特殊端口,具体用什么端口视情况而定,命令格式如下:
#scp -p 4588 [email protected]:/usr/local/sin.sh /home/administrator
2.使用scp要注意所使用的用户是否具有可读取远程服务器相应文件的权限。
以上是关于linux文件操作的主要内容,如果未能解决你的问题,请参考以下文章
VSCode自定义代码片段15——git命令操作一个完整流程
VSCode自定义代码片段15——git命令操作一个完整流程
LINUX PID 1和SYSTEMD PID 0 是内核的一部分,主要用于内进换页,内核初始化的最后一步就是启动 init 进程。这个进程是系统的第一个进程,PID 为 1,又叫超级进程(代码片段