0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SCPコマンドでホスト上のファイルをローカルにコピーする

Posted at

ネット回線のスピードの遅さが原因であったのか、大きなサイズのファイルをサーバーからSFTPツールでうまくダウンロードが出来ないことがありました。
何度やっても、ダウンロードが出来なかったので(他のファイルは正常にダウンロード出来る)、SCPコマンドでローカルPCに転送をしました。

SCPコマンドでファイル転送

以下、方法と例です。

  • ホスト名: example.com
  • SSHのポート: 22345
  • リモートのコピー元ファイルのパス: /home/Taro/works/taro_no_test.zip
  • ローカルのコピー先のパス: /Users/Taro/works/

SCPコマンド

scp -P [ポート番号] -i [公開鍵のパス] [ユーザー名]@[ホスト名]:[コピーしたいファイルのパス] [コピー先のパス]

SCPコマンド例

scp -P 22345 -i /Users/Taro/.ssh/example.com/id_rsa taro@example.com:/home/Taro/works/taro_no_test.zip /Users/Taro/works/
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?