Skip to content

Instantly share code, notes, and snippets.

@pocari
Created February 1, 2017 02:20
Show Gist options
  • Save pocari/7d620f7bca850b3e52796dff67d11676 to your computer and use it in GitHub Desktop.
Save pocari/7d620f7bca850b3e52796dff67d11676 to your computer and use it in GitHub Desktop.
ncで簡易ファイル転送
# 送信、受信側が同一のサンプルになっているが別ホストでも可
################################################################
# 単純にファイル転送
# 送信側ホスト
# ポート12345でdata.txtの内容を転送するための口を開けて待受
nc -l 12345 < data.txt
# 受信側ホスト
nc 127.0.0.1 12345 > data.txt
################################################################
# tar.gzで固めた内容を転送
# 送信側ホスト
tar zcvf - | nc -l 12345
# 受信側ホスト
nc 127.0.0.1 12345 | tar zxvf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment