Skip to content

Instantly share code, notes, and snippets.

@AaronPhalen
Last active October 7, 2015 14:49
Show Gist options
  • Save AaronPhalen/7923ab101c796c517709 to your computer and use it in GitHub Desktop.
Save AaronPhalen/7923ab101c796c517709 to your computer and use it in GitHub Desktop.
Basic commands for sftp in linux.
Author: Aaron Phalen | Twitter: @aaron_phalen | Email: [email protected]
Summary:
Basic commands for secure file transport protocol (sftp) in linux. Sftp
runs on the same port as ssh (22), and has similar secure encryption. Secure
file transport protocol is useful for quickly uploading or downloading files
from a linux server with the two verbs get and put, respectively. Generally,
sftp is a quick and lightweight alternative to an third part client
file transport protocol (ftp) such as FileZilla.
Basic Usage:
1. Login:
(i) sftp <username>@<ip-address>:<filedirectory> --> secure file transport login as username at ip address
and change directory to filedirectory.
2. Navigation:
(i) pwd --> show remote present working directory (remote)
(ii) lpwd --> show present working directory (local)
(iii) ls --> list files remote directory (remote)
(iv) lls --> list files present direcory (local)
(v) cd --> change remote directory (remote)
(vi) lcd --> change directory (local)
(vii) mkdir --> make remote directory (remote)
(viii) lmkdir --> make directory (local)
3. Transport:
(i) put <filename> <destination-directory> --> upload file from current local directory
to remote destination directory
(ii) get <filename> --> download file from current local directory
(iii) mget <filename1>, <filename2> --> download multiple files
(iv) mput <filename1>, <filename2> --> upload multiple files
(v) mget *.py --> can use wildcards: download all python files
4. Close:
(i) ! --> will exit us out of sftp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment