• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

sftp: command not found

by admin

sftp command is the implementation of the Secure File Transport Protocol (SFTP). SFTP uses SSH tunnel as a transportation mechanism to encrypt data. Whereas scp is used purely for transferring files, sftp can transfer files and manage files and directories. So, you can list, create, and remove directories on the remote system. The sftp command also supports resuming file transfers, whereas scp does not.

Just like with the standard ftp command, you can use sftp interactively or non-interactively. For example, to retrieve a file non-interactively:

# sftp user@host:file.txt

If you encounter the below error while running the sftp command:

sftp: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install openssh-client
Ubuntu apt-get install openssh-client
Alpine apk add openssh-client
Arch Linux pacman -S scp
Kali Linux apt-get install openssh-client
CentOS yum install openssh-clients
Fedora dnf install openssh-clients
Raspbian apt-get install openssh-client

sftp Command Examples in Linux

1. Connect to a remote server and enter an interactive command mode:

# sftp remote_user@remote_host

2. Connect using an alternate port:

# sftp -P remote_port remote_user@remote_host

3. Connect using a predefined host (in `~/.ssh/config`):

# sftp host

4. Transfer remote file to the local system:

get /path/remote_file

5. Transfer local file to the remote system:

put /path/local_file

6. Transfer remote directory to the local system recursively (works with `put` too):

get -R /path/remote_directory

7. Get list of files on local machine:

lls

8. Get list of files on remote machine:

ls

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to create and mount Btrfs file system (explained with examples)
  2. How to Start and Stop OSWatcher
  3. setserial Command Examples in Linux
  4. Beginners guide to Device Mapper (DM) multipathing
  5. last: command not found
  6. Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  7. kpackagetool5 Command Examples in Linux
  8. airpaste – Share messages and files on the same network using mDNS (Command Examples)
  9. How to Enable IPv6 in CentOS/RHEL 8
  10. Unable To Join Linux Samba Server To Windows Active Directory Domain

You May Also Like

Primary Sidebar

Recent Posts

  • “aws ses” Command Examples
  • “aws secretsmanager” Command Examples
  • “aws s3api” Command Examples
  • “aws s3” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright