Connect to server:
sftp -P [port no] user@dns_or_ip
Commands for the remote server:
pwd #print remote working directory
cd #open remote directory
ls #list remote files
Commands for the remote server(add a 'l' before each command):
lpwd # Print local working directory
lcd # Open local directory
lls # List local files
Transfer remote file to local:
get remote_file
# Rename the file that you want to get from remote
get remote_file new_name
# Get a directory(recursive)
get -r remote_directory
# Keep the same permissions to the files
get -Pr remote_directory
Send file from local to remote(Same as before, use 'put' instead of 'get'):
put local_file
# Rename the file that you want to get from local
put local_file new_name
# Get a directory(recursive)
put -r remote_directory
# Keep the same permissions to the files
put -Pr remote_directory
Exit:
exit