在Linux中,可以使用scp(secure copy)命令进行文件传输
scp /path/to/local/file username@remote_host:/path/to/remote/directory
其中,/path/to/local/file 是要传输的本地文件的路径,username 是远程主机的用户名,remote_host 是远程主机的地址,/path/to/remote/directory 是要将文件传输到的远程目录路径。
例如,将本地的file.txt传输到远程主机的/home/user/documents目录下,可以使用以下命令:
scp file.txt user@example.com:/home/user/documents
scp username@remote_host:/path/to/remote/file /path/to/local/directory
其中,username 是远程主机的用户名,remote_host 是远程主机的地址,/path/to/remote/file 是要传输的远程文件的路径,/path/to/local/directory 是要将文件传输到的本地目录路径。
例如,从远程主机的/home/user/documents/file.txt传输文件到本地的/home/user/downloads目录下,可以使用以下命令:
scp user@example.com:/home/user/documents/file.txt /home/user/downloads
在进行文件传输时,系统会要求您输入远程主机的密码。输入密码后,文件传输将开始。请注意,scp命令使用SSH协议进行加密传输,因此传输过程中的数据是安全的。