FTP クライアント - sftp コマンド - コマンド

クラウディア 
1. 概要
2. FreeBSD
3. 受信

1. 概要

 当初、「sftp」もコマンドは、「ftp」と同じでしょ。  と思っていたら。  送信しようとして、「send」を使ったら、エラーになっちゃった。  うむ、ちと違うようですな。  本ページは、下記のサイトを参考にさせていただきました。
sftp コマンドまとめ」
「SFTPを使用してリモートサーバーでファイルを安全に転送する方法

2. FreeBSD

 とりあえず、「FreeBSD」の「sftp」の「HELP」を掲載しておきます。  以下は、「FreeBSD 13.2 RELEASE」のものです。  「sftp」自体のバージョンの調べ方は、今のところわかりません。

sftp> help
Available commands:
bye                                Quit sftp
cd path                            Change remote directory to 'path'
chgrp [-h] grp path                Change group of file 'path' to 'grp'
chmod [-h] mode path               Change permissions of file 'path' to 'mode'
chown [-h] own path                Change owner of file 'path' to 'own'
copy oldpath newpath               Copy remote file
cp oldpath newpath                 Copy remote file
df [-hi] [path]                    Display statistics for current directory or
                                   filesystem containing 'path'
exit                               Quit sftp
get [-afpR] remote [local]         Download file
help                               Display this help text
lcd path                           Change local directory to 'path'
lls [ls-options [path]]            Display local directory listing
lmkdir path                        Create local directory
ln [-s] oldpath newpath            Link remote file (-s for symlink)
lpwd                               Print local working directory
ls [-1afhlnrSt] [path]             Display remote directory listing
lumask umask                       Set local umask to 'umask'
mkdir path                         Create remote directory
progress                           Toggle display of progress meter
put [-afpR] local [remote]         Upload file
pwd                                Display remote working directory
quit                               Quit sftp
reget [-fpR] remote [local]        Resume download file
rename oldpath newpath             Rename remote file
reput [-fpR] local [remote]        Resume upload file
rm path                            Delete remote file
rmdir path                         Remove remote directory
symlink oldpath newpath            Symlink remote file
version                            Show SFTP version
!command                           Execute 'command' in local shell
!                                  Escape to local shell
?                                  Synonym for help

3. 受信

 受信コマンドとして、「get」「mget」が使えます。  リモートからローカルにファイルを受信するには。

get ファイル名
 これで、リモートのカレントディレクトリから、ローカルのカレントディレクトリへファイルを受信します。  ディレクトリをまとめて受信するには。

get -r ディレクトリ名
 受信元のタイムスタンプを保持するには、「-P」オプションを使用します。

get -P ファイル名
earthcar(アースカー)