Skip to content

Instantly share code, notes, and snippets.

@agniswarm
Last active July 22, 2025 13:08
Show Gist options
  • Save agniswarm/af4c32e3b33994734df4b1201d7d3848 to your computer and use it in GitHub Desktop.
Save agniswarm/af4c32e3b33994734df4b1201d7d3848 to your computer and use it in GitHub Desktop.
SFTP Commands

1. 📂 Directory Navigation (Remote & Local)

Command Description Example
pwd Show current remote directory pwd
lpwd Show current local directory lpwd
cd <path> Change remote directory cd /data/reports
lcd <path> Change local directory lcd ~/Downloads
ls List files in remote directory ls
lls List files in local directory lls

2. ⬇️⬆️ Download & Upload Files

Command Description Example
get <remote_file> Download file from remote get data.csv
put <local_file> Upload file to remote put notes.txt
get -r <remote_dir> Download directory recursively get -r reports/
put -r <local_dir> Upload directory recursively put -r logs/

3. 🔁 File Transfers with Renaming

Command Description Example
get <remote_file> <local_name> Download & rename file locally get data.csv report_2025.csv
put <local_file> <remote_name> Upload & rename file remotely put summary.txt report_latest.txt

4. 🛠️ Managing Remote Files

Command Description Example
mkdir <folder> Create remote directory mkdir uploads
rmdir <folder> Remove remote directory rmdir old_reports
rm <filename> Delete remote file rm temp.txt
rename <old> <new> Rename remote file rename old.txt new.txt

5. ❌ Exit Session

Command Description Example
exit Exit SFTP exit
bye Same as exit bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment