The method of transferring files between linux remote server and local server SSH (Ubantu system)

A few things to know ahead of time :

1. The MobaXterm software used 2. To access local and remote servers, account numbers and passwords are required ( username and password
on the remote machine, IP address or host name of the remote machine (on the same subnet)). You need to enter a password every time you visit, you can search for Ubuntu SSH password-free login 3. The main thing is to access the local server before you can access the remote server. The graphics card is installed on the remote server. When running deep learning , first upload to the local, then copy to the remote. If the training is complete, the parameter file is uploaded locally.

If you don’t know how to use MobaXterm yet , you can refer to this link to use
MobaXterm to connect to the server and use Anaconda to install the pytoch framework to run the deep learning model (use the school server + graphics card for deep learning)

If you want to use the server to run the deep learning model, you can refer to this link
Use MobaXterm to connect to the server and use Anaconda to run the deep learning model LeNet-5 classification in the pytoch environment

4 Ways to Transfer Files Over SSH - wikiHow

1.scp: an old deprecated command
2.rsync: a popular command for file synchronization
3.sshfs: mount a remote directory via SSH
4.sftp client: a GUI tool for accessing files via SFTP

1. scp command (commands are all input on the local server)

(1) Local to remote: run locally

scp -r file directory account name@remote IP:remote directory (command pwd to view the remote directory path)

scp file name account name@remote IP:remote directory (command pwd to view the path of the remote directory)

%%没传输前,查看远端目录文件情况
wlc@hz-A100-40:/data/WLC/WKL$ ls
carb_classfication  deep-learning-for-image-processing-master  deep-learningfor-image-processing-master.zip  zjdata

%%传送文件夹是carb,详细指令
wlc@hz-jumper:~$ scp -r "/home/wlc/WKL/carb/" wlc20222022@172.20.198.3:/data/WLC/WKL 

%%查看传输成功
wlc@hz-A100-40:/data/WLC/WKL$ ls
carb  carb_classfication  deep-learning-for-image-processing-master  deep-learning-for-image-processing-master.zip  zjdata

%%这里我把anaconda传过去
scp -r "/home/wlc2021388321/Anaconda3-2023.07-0-Linux-x86_64.sh" [email protected]:/data/WLC/

insert image description here

(2) Remote to local: remote operation

scp -r account name@remote IP:remote directory local directory

wlc@hz-jumper:~$ scp -r [email protected]:/data/WLC/WKL/carb/Test2_alexnet "/home/wlc2021388321/WKL/"
1.jpg                                                                                                   100% 1400KB  96.1MB/s   00:00
predict1.py                                                                                             100% 1518     5.4MB/s   00:00
3.jpg                                                                                                   100%   21KB  37.9MB/s   00:00
train.py                                                                                                100% 4977    15.9MB/s   00:00
model.py                                                                                                100% 2061     6.6MB/s   00:00
model.cpython-38.pyc                                                                                    100% 1727     3.7MB/s   00:00
model.cpython-39.pyc                                                                                    100% 1749     4.2MB/s   00:00
Test2_alexnet.iml                                                                                       100%  340   828.8KB/s   00:00
.gitignore                                                                                              100%   50   132.1KB/s   00:00
misc.xml                                                                                                100%  308   879.6KB/s   00:00
.name                                                                                                   100%    8    23.6KB/s   00:00
modules.xml                                                                                             100%  285   819.8KB/s   00:00
workspace.xml                                                                                           100% 6342    17.1MB/s   00:00
profiles_settings.xml                                                                                   100%  174   738.5KB/s   00:00
Project_Default.xml                                                                                     100% 1504     2.5MB/s   00:00
predict.py                                                                                              100% 1911     7.6MB/s   00:00
2.jpg      

##从远端传输到本地
wlc@hz-jumper:~$ ls
b  c  snap  wanghao  WKL
wlc@hz-jumper:~$ cd WKL
wlc@hz-jumper:~/WKL$ ls
carb  Test2_alexnet  zj4
          

Guess you like

Origin blog.csdn.net/qq_55433305/article/details/131683863