-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux sftp Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to sftp on Linux, covering Arch Linux, CachyOS, and other distributions including secure file transfer protocol, interactive file operations, and remote file management.
Basic usage:
# Connect to server
sftp user@server
# Opens interactive sftp sessionNon-standard port:
# Custom SSH port
sftp -P 2222 user@server
# -P = port (capital P for sftp)Common commands:
# In sftp:
# ls - List remote files
# lls - List local files
# cd - Change remote directory
# lcd - Change local directory
# pwd - Print remote working directory
# lpwd - Print local working directoryTransfer files:
# In sftp:
# get file.txt - Download file
# put file.txt - Upload file
# get -r directory/ - Download directory
# put -r directory/ - Upload directoryGet files:
# In sftp:
# get file.txt
# get file.txt local_name.txt
# get -r directory/Put files:
# In sftp:
# put file.txt
# put file.txt remote_name.txt
# put -r directory/Automated transfer:
# Create batch file
echo "get file.txt" > batch.txt
echo "put local.txt" >> batch.txt
# Run batch
sftp -b batch.txt user@server
# -b = batch (executes commands from file)Check SSH:
# Test SSH connection
ssh user@server
# Ensure SSH works firstCheck permissions:
# On server, check directory permissions
ls -la /path/to/directoryThis guide covered sftp usage, secure file transfer, and remote file management for Arch Linux, CachyOS, and other distributions.
- scp Guide - Simple file copying
- rsync Guide - Advanced synchronization
- SSH Configuration - SSH setup
-
sftp Documentation:
man sftp
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.