Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the scp command to upload or download files remotely by Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "Linux how to use the scp command to upload or download files remotely". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how Linux uses the scp command to upload or download files remotely".

Command: scp

There are three common methods for copy files between different Linux:

The first is ftp, that is, one of the Linux installs ftp Server, so that the other uses ftp's client program to copy files.

The second method is to use samba service, which is similar to Windows file copy, which is relatively simple and convenient.

The third is to use the scp command to copy files.

Scp is a file copy with Security, which is logged in based on ssh. It is easy to operate, for example, to copy a current file to another remote host, you can use the following command.

Scp / home/daisy/full.tar.gz root@172.19.2.75:/home/root

Then you will be prompted to enter the login password of the root user on the other 172.19.2.75 host, and then you will start copy.

It is also easy to copy files from the remote host to the current system if you want to do the reverse.

Scp root@/full.tar.gz 172.19.2.75:/home/root/full.tar.gz home/daisy/full.tar.gz

Linux's scp command copies files and directories between linux

Exampl

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

DESCRIPTION: scp copies files between hosts on a network.

Using scp to transfer files

1. Download files from the server

Scp username@servername:/path/filename / tmp/local_destination

For example, scp codinglog@192.168.0.101:/home/kimi/test.txt put / home/kimi/test.txt on 192.168.0.101

Download the file to / tmp/local_destination

2. Upload local files to the server

Scp / path/local_filename username@servername:/path

For example, scp / var/www/test.php codinglog@192.168.0.101:/var/www/ transfers the test.php file in the local / var/www/ directory

Upload to the / var/www/ directory on the server 192.168.0.101

3. Download the entire directory from the server

Scp-r username@servername:remote_dir/ / tmp/local_dir

For example: scp-r codinglog@192.168.0.101 / home/kimi/test / tmp/local_dir

4. Upload the directory to the server

Scp-r / tmp/local_dir username@servername:remote_dir

For example:

Scp-r test codinglog@192.168.0.101:/var/www/ uploads the test directory under the current directory to the server's / var/www/ directory

Thank you for your reading, the above is the "Linux how to use the scp command for remote file upload or download" content, after the study of this article, I believe that Linux how to use the scp command for remote file upload or download this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report