FTP クライアントの使い方

通常他のマシンからアーカイブをコピーしてくるためには ftp がよく使われる。 Web ブラウザがインストールしてあれば、ftp://サーバ名/... としてアクセス すればすむ。しかしインストール時はまだ使えないので、コマンドライン版の ftp クライアントを使う必要がある。以下、簡単に説明する。

server1:~$ ftp server1[Enter]   ←サーバ server1 に接続
Connected to server1.hoge.co.jp
220 server1.hoge.co.jp FTP server (Version wu-2.4.2-academ[BETA-18-VR14](1) Wed Feb 17 09:13:08 JST 1999) ready.
Name (server1:otmrc): ftp[Enter]   ←ユーザ名 ftp でログイン
331 Guest login ok, send your complete e-mail address as password.
Password: (何でも良い。表示されない)
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls[Enter]               ← ls が使える
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 9
drwxr-xr-x   8 root     wheel        1024 Dec  2 01:37 .
drwxr-xr-x   8 root     wheel        1024 Dec  2 01:37 ..
drwxrwxr-x   2 root     wheel        1024 Aug 11  1998 bin
drwxrwxr-x   2 root     wheel        1024 Aug 11  1998 etc
drwxrwxrwx   2 root     wheel        1024 Apr 23 00:45 incoming
drwxrwxr-x   2 root     wheel        1024 Nov 17  1993 lib
drwxrwxr-x  19 root     wheel        1024 Apr 23 00:45 pub
drwxrwxr-x   3 root     wheel        1024 Aug 11  1998 usr
-rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg
226 Transfer complete.
ftp> cd pub[Enter]           ← cd も使える
250 CWD command successful.
ftp> ls[Enter]
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 19
drwxrwxr-x  19 root     wheel        1024 Apr 23 00:45 .
drwxr-xr-x   8 root     wheel        1024 Dec  2 01:37 ..
drwxr-xr-x   2 10002    users        1024 Apr 23 00:38 apache
drwxr-xr-x   2 10001    users        1024 Dec 22 03:23 custom
drwxr-xr-x   2 10002    users        1024 Apr 23 00:38 dns
drwxr-xr-x   2 10002    users        1024 Apr 23 00:38 docs
-rwxrwxr-x   1 root     wheel           0 Jul 10  1993 dummy_test_file
drwxr-xr-x   2 10002    users        1024 Apr 23 00:39 linux
drwxr-xr-x   2 10002    users        1024 Apr 23 00:39 mail
drwxr-xr-x   2 10002    users        1024 Apr 23 00:39 mebius
drwxr-xr-x   2 10002    users        1024 Apr 23 00:40 mirror
drwxr-xr-x   2 10002    users        1024 Apr 23 00:40 misc
drwxr-xr-x   2 10002    users        1024 Apr 23 00:40 mozilla
drwxr-xr-x   2 10002    users        1024 Apr 23 00:40 pg632
drwxr-xr-x   2 10002    users        1024 Apr 23 00:41 pg64
drwxr-xr-x   2 10002    users        1024 Apr 23 00:41 php
drwxr-xr-x   2 10002    users        1024 Apr 23 00:41 samba
drwxr-xr-x   2 10002    users        1024 Apr 23 00:45 snmp
drwxr-xr-x   2 root     root         1024 Feb 17 00:11 unix
drwxr-xr-x   2 10002    users        1024 Apr 23 00:42 win32
226 Transfer complete.
tp> cd mozilla[Enter]
250 CWD command successful.
ftp> ls[Enter]
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 13369
drwxr-xr-x   2 10002    users        1024 Apr 23 00:40 .
drwxrwxr-x  19 root     wheel        1024 Apr 23 00:45 ..
-rw-r--r--   1 10002    users      949413 Apr 23 00:40 communicator-ja-v408-export_x86-unknown-linux2_0_tar.gz
-rw-r--r--   1 10002    users    12681182 Apr 23 00:40 communicator-v408-export_x86-unknown-linux2_0_libc5_tar.tar
226 Transfer complete.
ftp> mget *[Enter]           ← 全ファイルの取得を要求
mget communicator-ja-v408-export_x86-unknown-linux2_0_tar.gz? y[Enter]
200 PORT command successful.
150 Opening BINARY mode data connection for communicator-ja-v408-export_x86-unknown-linux2_0_tar.gz (949413 bytes).
226 Transfer complete.
949413 bytes received in 1.11 secs (8.4e+02 Kbytes/sec)
mget communicator-v408-export_x86-unknown-linux2_0_libc5_tar.tar? y[Enter]
200 PORT command successful.
150 Opening BINARY mode data connection for communicator-v408-export_x86-unknown-linux2_0_libc5_tar.tar (12681182 bytes).
226 Transfer complete.
12681182 bytes received in 19.4 secs (6.4e+02 Kbytes/sec)
ftp> quit[Enter]           ← 終了する
221-You have transferred 13630595 bytes in 2 files.
221-Total traffic for this session was 13634370 bytes in 6 transfers.
221-Thank you for using the FTP service on server1.hoge.co.jp
221 Goodbye.