Terminal

It is well known that everything you can do using software with UI can be done using a Terminal. Apart from the ssh command, there is one more that allows us to transfer files. Type the following command in your terminal:

sftp  

Similar to the ssh manual, you will see something similar to the following; the syntax is pretty much the same:

So, to connect to a server with the purpose of transferring files, we need to execute the sftp command as follows:

sftp user@IPaddr  

Here, the user is our username on the remote server. In the Raspberry Pi, it is pi and the IPaddr is the IP address of the Raspberry Pi. In our example, it is 192.168.1.125. If we execute this command, we will see that it needs our password. Using the preceding procedure that we have already described, we can automate the needed password. However, after submitting the password, we will see that the bash has changed. Now, there are two ways to interact with the remote server. We can put and get files from the server. You can easily transfer files from the remote server to your local machine with the get command:

    get file1.txt  

Alternatively, you can upload files from your local machine to the remote server using the put command:

    put mylocalfile.txt  

Note that depending on the local machine directory from which we started the sftp command, we can put and get files accordingly. This means that if we were in the /home/nick/ folder, we can directly upload only files that are inside in the nick folder with the put command.

For more information about ssh and sftp, read the manual page with:
  • man ssh
  • man sftp
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.244.228