LoginSignup
27
38

More than 5 years have passed since last update.

今さら聞けないMacのターミナルでFTP

Last updated at Posted at 2016-06-30

ここではローカル/Users/xxxxxxxxxx/work/sampleのindex.htmlをリモートの/sampleにアップロードします。

ログインする

ftp実行

ftpコマンドを実行するとftpのプロンプトが表示されます。

ftp
$ ftp
結果
$ ftp
ftp>

open実行

openコマンドを実行するとアドレスの入力を促されます。

open
ftp> open
結果
ftp> open
(to)

アドレスを入力

このとき私はyahooのgeocitiesを利用していたので、ftp.geocities.jpです。
接続できると、パスワードの入力を求められます。

アドレスを入力
ftp> open
(to) ftp.geocities.jp
結果
ftp> open
(to) ftp.geocities.jp
Connected to ftp.geocities.jp.
220-Welcome to GeoFTPd.
220-You are user number 39 of 128 allowed.
220-Local time is now 08:48. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 15 minutes of inactivity.
Name (ftp.geocities.jp:xxxxxxxxxxx): xxxxxxxxxx
331 User xxxxxxxxx OK. Password required
Password: 

xxxxxxxxxはユーザー情報を表しています。

パスワードを入力

パスワードを入力
Password: 
結果
Password: 
230-OK. Current directory is /
230 2 Kbytes used (0%) - authorized: 97656 Kb
Remote system type is UNIX.
Using binary mode to transfer files.

これでログインできました。

リモートにディレクトリを作成→ローカルのファイルをアップロード

リモートにディレクトリを作成

mkdir
ftp> mkdir sample
結果
ftp> mkdir sample
257-"sample" : The directory was successfully created
257 0 Kbytes used (0%) - authorized: 97656 Kb

作成したディレクトリに移動

cd
ftp> cd sample
結果
ftp> cd sample
250 OK. Current directory is /sample

lcdでローカルのディレクトリに移動

lcd
ftp> lcd /Users/xxxxxxxxxx/work/sample
結果
ftp> lcd /Users/xxxxxxxxxx/sample
Local directory now: /Users/xxxxxxxxxx/work/sample

putでローカルのファイルをリモートにアップロード

/Users/xxxxxxxxxx/work/sampleにあるindex.htmlをアップロードします。

put
ftp> put index.html
結果
ftp> put index.html
local: index.html remote: index.html
200 PORT command successful
150 Connecting to port 56318
100% |***********************************|   489        1.03 MiB/s    00:00 ETA
226-2 Kbytes used (0%) - authorized: 97656 Kb
226-File successfully transferred
226 0.052 seconds (measured here), 9.24 Kbytes per second
489 bytes sent in 00:00 (7.80 KiB/s)

これでアップロードできました。

27
38
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
38