LoginSignup
82
90

More than 5 years have passed since last update.

【ターミナル(Linux,Mac)】scpコマンドでサーバとファイルのやり取りをする

Posted at

ファイルをアップロードする

$ scp アップロードするファイル名 サーバのユーザID@サーバのドメイン:アップロード先のディレクトリ
というコマンドを利用します.

以下,デスクトップ上にある「image.jpeg」を,hogehoge.jpサーバのsampleユーザのディレクトリにアップロードするとして,
$ scp ~/Desktop/image.jpeg sample@hogehoge.jp:~/Desktop/
となります.

ファイルをダウンロードする

$ scp サーバのユーザID@サーバのドメイン:ダウンロードするファイル ダウンロード先
というコマンドを利用します.

以下,hogehoge.jpサーバのsampleユーザのDesktopにある「image.jpeg」ファイルを,自分のPCのDesktopにダウンロードするとして,
$ scp sample@hogehoge.jp:~/Desktop/image.jpeg ~/Desktop/
となります.

82
90
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
82
90