The linux command is a command for managing the Linux system. For the Linux system, whether it is the central processor, memory, disk drive, keyboard, mouse, or user, they are all files. The commands for Linux system management are the core of its normal operation, similar to the previous DOS commands. There are two types of Linux commands in the system: built-in Shell commands and Linux commands. There are three common methods for copying files between different Linuxes: The first is ftp, which means installing ftpServer on one Linux, so that the other one can use the ftp client program to copy files. The second method is to use the samba service, which is similar to Windows file copy and is relatively simple and convenient. The third method is to use the scp command to copy files. The scp command is generally used between Linux systems to transfer files through the ssh protocol. Here are just a few examples for remarks.
1. Download files from the server
scp username@servername:/path/filename /var/www/local_dir (local directory)
For example
scp -P 2015 root@192.168.0.101:/var/www/test.txt
Download the /var/www/test.txt file on 192.168.0.101 to /var/www/local_dir ( Local directory), the port number parameter (-P 2015) is used here. If the port number is 22, the port number parameter here can be omitted.
2. Upload local files to the server
scp /path/filename username@servername:/path
For example
scp -P 2015 /var/www/test.php root@192.168.0.101:/var/www/
Upload the test.php file in the local /var/www/ directory to the server 192.168.0.101 /var/www/ directory
3. Download the entire directory from the server
scp -r username@servername:/var/www/remote_dir/(remote directory) /var/www/local_dir (Local directory)
For example
scp -r root@192.168.0.101:/var/www/test /var/www/
4. Upload the directory to the server
scp -r local_dir username@servername:remote_dir
For example
scp -P 2015 -r test root@192.168.0.101:/var/www/
Upload the test directory in the current directory to the server's /var/www/ directory
Note: The target server must enable write permissions
The above is the transmission between several commonly used Linux systems File command, I hope it can help everyone.
Related recommendations:
The latest Linux command collection
The above is the detailed content of Commands for transferring files between several commonly used Linux systems. For more information, please follow other related articles on the PHP Chinese website!