Smiley face
 
  Forum Index    Search    Usergroups    Edit your profile    Members    Arcade    Ranks

 Reputation    Medals    Staff    Statistics    Board Rules    Forum FAQ    Private MessagesLogin, Check Messages    Log in 

Search for at
Soldier Of Fortune 2 Advanced Search



Post new topicReply to topicprinter-friendly view
   Soldier Of Fortune 2 Forum Index » Linux Talk » 10 sFTP Command Examples to Transfer Files on Remote Servers
 View previous topic :: View next topic  
Author Message
Teo
Owner
Owner
Administrator
Administrator


In Game: Teo

Joined: Sep 21, 2009
Last Visit: Jun 24, 2017
Age: 36
Posts: 1107
Location: Milan
Italy.png 
Reputation: 4512
votes: 6
Medals: 6 (View more...)
Modder (Amount: 1)

Status: Offline
PostPosted: Mon Jul 13, 2015 4:07 pm
PostPost subject: No icon 10 sFTP Command Examples to Transfer Files on Remote Servers
Reply with quote

1. How to Connect to SFTP
By default, same SSH protocol is used to authenticate and establish a SFTP connection. To start an SFTP session, enter the username and remote hostname or IP address at the command prompt. Once authentication successful, you will see a shell with an sftp> prompt.
Code:
[root@tecmint ~]# sftp tecmint@27.48.137.6

Connecting to 27.48.137.6...
tecmint@27.48.137.6's password:
sftp>


2. Getting Help
Once, you in the sftp prompt, check the available commands by typing ‘?‘ or ‘help‘ at command prompt.
Code:
sftp> ?
Available commands:
cd path                       Change remote directory to 'path'
lcd path                      Change local directory to 'path'
chgrp grp path                Change group of file 'path' to 'grp'
chmod mode path               Change permissions of file 'path' to 'mode'
chown own path                Change owner of file 'path' to 'own'
help                          Display this help text
get remote-path [local-path]  Download file
lls [ls-options [path]]       Display local directory listing
ln oldpath newpath            Symlink remote file
lmkdir path                   Create local directory
lpwd                          Print local working directory
ls [path]                     Display remote directory listing
lumask umask                  Set local umask to 'umask'
mkdir path                    Create remote directory
put local-path [remote-path]  Upload file
pwd                           Display remote working directory
exit                          Quit sftp
quit                          Quit sftp
rename oldpath newpath        Rename remote file
rmdir path                    Remove remote directory
rm path                       Delete remote file
symlink oldpath newpath       Symlink remote file
version                       Show SFTP version
!command                      Execute 'command' in local shell
!                             Escape to local shell
?                             Synonym for help


3. Check Present Working Directory
The command ‘lpwd‘ is used to check the Local present working directory, whereas ‘pwd‘ command is used to check Remote working directory.
Code:
sftp> lpwd
Local working directory: /
sftp> pwd
Remote working directory: /tecmint/


lpwd – print the current directory on your system
pwd – print the current directory on the ftp server

4. Listing Files
Listing files and directories in local as well as remote system.

On Remote
Code:
sftp> lls


5. Upload File
Put single or multiple files in remote system.
Code:
sftp> put local.profile
Uploading local.profile to /tecmint/local.profile


6. Upload Mutiple Files
Putting multiple files on in remote system.
Code:
sftp> mput *.xls


6. Download Files
Getting single or multiple files in local system.
Code:
sftp> get SettlementReport_1-10th.xls
Fetching /tecmint/SettlementReport_1-10th.xls to SettlementReport_1-10th.xls


Get multiple files on a local system.
Code:
sftp> mget *.xls


Note: As we can see by default with get command download file in local system with same name. We can download remote file with different name specifying the name at the end. (This applies only while downloading single file).

7. Switching Directories
Switching from one directory to another directory in local and remote locations.

On Remote
Code:
sftp> cd test
sftp>


On Local
Code:
sftp> lcd Documents


8. Create Directories
Creating new directories on local and remote locations.
Code:
sftp> mkdir test

Code:
sftp> lmkdir Documents


9. Remove Directories
Remove directory or file in remote system.
Code:
sftp> rm Report.xls

Code:
sftp> rmdir sub1


Note: To remove/delete any directory from remote location, the directory must be empty.

10. Exist sFTP Shell
The ‘!‘ command drop us in local shell from where we can execute Linux commands. Type ‘exit‘ command where we can see sftp> prompt return.
Code:
sftp> !

[root@sftp ~]# exit
Shell exited with status 1
sftp>


Conclusion
The SFTP is a very useful tool for administrating servers and transferring files to and from (Local and Remote). We hope this tuts will help you to understand the usage of SFTP in some extent.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Visit member's Facebook: http://www.facebook.com/ricordalo
Sponsor
BuLLy
Active
Active



Joined: Jun 29, 2015
Last Visit: Jun 24, 2017
Age: 34
Posts: 10

blank.png 
Reputation: 26
Medals: None

Status: Offline
PostPosted: Wed Jul 15, 2015 12:24 pm
PostPost subject: No icon Re: 10 sFTP Command Examples to Transfer Files on Remote Ser
Reply with quote

Or download WinSCP which is a free sFTP client with a nice GUI, takes most of the need for remembering / typing commands away.
Back to top
View user's profile Send private message
Teo
Owner
Owner
Administrator
Administrator


In Game: Teo

Joined: Sep 21, 2009
Last Visit: Jun 24, 2017
Age: 36
Posts: 1107
Location: Milan
Italy.png 
Reputation: 4512
votes: 6
Medals: 6 (View more...)
Site Supporter (Amount: 1)

Status: Offline
PostPosted: Wed Jul 15, 2015 4:49 pm
PostPost subject: No icon Re: 10 sFTP Command Examples to Transfer Files on Remote Ser
Reply with quote

BuLLy wrote (View Post):
Or download WinSCP which is a free sFTP client with a nice GUI, takes most of the need for remembering / typing commands away.


you can use also scp with sshpass, but this tutorial is aimed to the sftp. If you like Linux and you'd like to share something you can always write some tutorial Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website Visit member's Facebook: http://www.facebook.com/ricordalo
Display posts from previous:
Post new topicReply to topic printer-friendly view
Soldier Of Fortune 2 Forum Index »  Linux Talk
 
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Cant download 4 el3freet99 2967 Wed Jan 02, 2013 7:10 pm
Teo View latest post
No new posts cant download 1 azrox3 1894 Fri Oct 26, 2012 12:33 am
azrox3 View latest post
No new posts cant download 1 Koray66 2054 Sat Oct 20, 2012 6:05 pm
Teo View latest post
No new posts Where to download sof2 full in one file and installation?! 11 badass 7466 Sun Oct 07, 2012 11:12 pm
lasenmahav View latest post
 




Back to Top

SOF2.ORG Multiplayer Community © 2017 All times are UTC + 2 Hours [DST enabled]
 

Copyright ©