sftp command shell code example

Example: sftp command

# Connexion to default port 22
sftp your_user@your_server_ip_or_remote_hostname
sftp> ? 			# help
# SFTP get local directory
sftp> lpwd
sftp> lls			# list of files in local directory
sftp> lcd mydir		# change local directory
# SFTP get remote directory
sftp> pwd
sftp> ls			# list of files in remote directory
sftp> cd mydir		# change remote directory
# put single file from local to remote directory
sftp> put myfile
# put multiple files from local to remote directory
sftp> mput *.txt
# get single file from remote to local directory
sftp> get myfile
# put multiple files from remote to local directory
sftp> mget *.txt