xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux scp command All In One

Linux scp command All In One

SFTP

SCP

scp copies files between hosts on a network.

-p Preserves modification times, access times, and modes from the original file.

-p 保留以下内容的修改时间,访问时间和模式 原始文件。

-r Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.

-r 递归复制整个目录。请注意,scp遵循 在树遍历中遇到的符号链接。

# copy folder
$ scp -rp /path/to/local/dir usrname@remote_server_ip:/path/to/remote/folder


# copy file
$ scp -p /path/to/local/dir/file usrname@remote_server_ip:/path/to/remote/folder/

# ???
$ scp -p /path/to/local/dir/file usrname@remote_server_ip:/path/to/remote/folder/filename

demo

# scp -rp /path/to/local/dir usrname@orgname.edu:/path/to/remote/dir

# folder
$ scp -rp /Users/xgqfrms-mbp/Documents/express-server root@196.128.1.123:/root/front-end/express-server

# file
$ scp -p /Users/xgqfrms-mbp/Documents/express-server/app.js root@196.128.1.123:/root/front-end/express-server

# ???
$ scp -p /Users/xgqfrms-mbp/Documents/express-server/app.js root@196.128.1.123:/root/front-end/express-server/app.js

SSH

# 查看本机是否安装 SSH 
$ rpm -qa | grep ssh

# 安装SSH
$ yum install openssh-server

# 开启 SSH 服务
$ service sshd start

# 查看 22 号端口是否开启
$ netstat -ntpl | grep 22

refs

https://man7.org/linux/man-pages/man1/scp.1.html

https://stackoverflow.com/questions/39457759/copying-a-local-file-from-mac-to-an-ssh-session-in-terminal/39457811

https://www.unix.com/unix-for-dummies-questions-and-answers/134359-uploading-files-mac-unix-linux-via-ssh.html

https://stackoverflow.com/questions/1273569/upload-folder-via-mac-terminal



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-04-15 11:25  xgqfrms  阅读(121)  评论(3编辑  收藏  举报