ftpとは、ネットワークで接続された他のコンピュータとの間でファイルを転送するFTPクライアントである。
ftp [option]... [host]
tnftp [option]... [host]
ftp と tnftp という2つのコマンドがあるが、どちらも機能は同じである。
次の引数を ftp および tnftp コマンドに指定できる。
指定したリモートホスト(相手のコンピュータ)に接続し、ファイルを転送します。リモートホストには、ftpd(サーバ)が設定されていることと、ユーザ名が登録されていなければなりません。ftpでログインが完了すると、ftp>
というプロンプトが現れますので、そこからftpのコマンドを実行することで、ファイルの転送が行えます。
以下に示すオプションを ftp および tnftp コマンドに指定できる。
ftp のコマンドを次に示します。
ascii
ascii
コマンドを使用する。
ftp> ascii
200 Type set to A.
binary
binary
コマンドを使用する。
ftp> binary
200 Type set to I.
bye
ftp
コマンドを終了する。
ftp> bye
$
リモートホストと接続中に bye
コマンドを実行すると、リモートホストと切断してから ftp
を終了する。
ftp> bye
221 Goodbye.
$
close
ftp> close
221 Goodbye.
ftp>
delete filename
ftp> delete example.html
mdelete filename...
ftp> mdelete example.*
get filename
ftp> get ar505jpn.exe
200 PORT command successful.
150 Binary data connection for ar505jpn.exe (202.217.161.212,5003) (10361792 bytes).
226 Binary Transfer complete.
ftp: 10361792 bytes received in 10.56Seconds 980.95Kbytes/sec.
ftp>
open host [port]
$ ftp
ftp> open ftp.example.com
Connected to ftp.example.com
220 FTP OK
Name (ftp.example.com): tsuka
331 Password required for tsuka.
Password:
230 User ftp.example.com logged in.
ftp>
put filename
ftp> put SourceExit.java
200 PORT command successful.
150 ASCII data connection for SourceExit.java (202.217.161.212,5001).
226 Transfer complete.
ftp: 1944 bytes sent in 0.03Seconds 60.75Kbytes/sec.
ftp>
ftp
コマンドを終了する。
ftp> quit
$
リモートホストと接続中に quit
コマンドを実行すると、リモートホストと切断してから ftp
を終了する。
ftp> quit
221 Goodbye.
$
FTPサーバ(リモートホスト)に対してユーザ名を通知する。
リモートホストに接続するには、2通りの方法がある。
ftpを実行すると、ftp> というプロンプトが現れる。リモートホストへ接続するには、openコマンドを使用する。openコマンドの引数には、接続するリモートホストのホスト名かIPアドレスを指定する。
C:\>ftp
ftp> open ultra28
Connected to ultra28.
220 ultra28 FTP server (SunOS 5.8) ready.
User (ultra28:(none)): umeda
331 Password required for umeda.
Password:
230 User umeda logged in.
ftp>
ftpの実行と同時にリモートホストへ接続するには、接続するリモートホストのホスト名かIPアドレスをftpコマンドの引数に指定する。
C:\>ftp 202.217.161.204
Connected to 202.217.161.204.
220 ultra28 FTP server (SunOS 5.8) ready.
User (202.217.161.204:(none)): umeda
331 Password required for umeda.
Password:
230 User umeda logged in.
ftp>
C:\>ftp 202.217.161.204
Connected to 202.217.161.204.
220 ultra28 FTP server (SunOS 5.8) ready.
User (202.217.161.204:(none)): scott
331 Password required for scott.
Password:
230 User scott logged in.
ftp> binary
200 Type set to I.
ftp> get ar505jpn.exe
200 PORT command successful.
150 ASCII data connection for ar505jpn.exe
(202.217.161.212,1041) (10361792 bytes).
226 ASCII Transfer complete.
ftp: 10399500 bytes received in 10.70Seconds 972.28Kbytes/sec.
ftp> quit
221 Goodbye.
C:\>