マルチサーバーLinux環境では、1つまたは複数のファイルを1つのサーバーから別のサーバーに移動する作業が多く発生する。移動する必要があるファイルの数に応じて、あなたを助けるかもしれないいくつかのコマンドがあります。このWikiHowでは、scpコマンドを使用して、Linuxシステム間でファイルやディレクトリを安全に転送する方法を説明します。
- scpコマンドの構文は、scp filename username@hostname:filenameです。
- ディレクトリを転送するには、scp -r /path/to/local_directory username@hostname:/path/to/remote_directory とします。
- 複数の個別ファイルを一度にコピーするには、まずそれらをtarボールに追加する。
1
単一ファイルの場合は、"scp "コマンドを試す。これは「プッシュ」コマンドとしても「プル」コマンドとしても使えるが、まずはファイルを相手サーバーにプッシュすることから始めよう。ここでは、サーバを Alice と Madhat とし、Alice のユーザを rabbit、 Madhat のユーザを Fieldmouse とします。
- アリス上で scp localfile fieldmouse@madhat:remotefilename コマンドを使います。これで、fieldmouseのユーザーIDに "remotefilename "という名前でファイルがコピーされます。
- Madhatにログインしている場合は、scp rabbit@alice:localfilename remotefilenameというコマンドで同じように簡単にファイルを取り出せます。
- 一度転送したファイルを同じ名前にしたい場合は、リモートファイル名を省略できます。
2
ディレクトリ全体をコピーするには、再び "scp "コマンドを使う。scp -r /path/to/local_directoryユーザー名@ホスト名:/path/to/remote_directoryは、ディレクトリ"/path/to/local_directory "全体を、そのすべてのサブディレクトリを含めて、/path/to/remote_directoryディレクトリのもう一方のシステムにコピーする。
3
コピーするファイルやディレクトリが大量に "ゴチャゴチャ "している場合はどうすればいいのだろう?コマンドを使って1つのファイルを作成し、そのファイルを上記のようにコピーして、tarを使ってもう一方のサーバーで展開することもできる。しかし、それではUnixらしくない。ワンステップでできる方法があるはずでしょう?もちろんそうだ!
- お好きなシェルのパイプをどうぞ。tarを使って必要なファイルをパッケージ化し、sshを使って他のシステムに転送し(これはscpが隠れて使っていたものだ)、反対側でtarを使ってファイルを展開し直す。
- しかし、2つのシステムにまたがるパイプを作成し、それを介してtarデータを転送できるのに、なぜ実際のtarファイルを作成する時間とスペースを浪費するのだろうか?前の例と同じディレクトリを使って、tar -cf - mydir/*を試してみよう。
この記事は、CC BY-NC-SAの下で公開された "
How to Transfer Files from One Linux Server to Another " を改変して作成した。特に断りのない限り、CC BY-NC-SAの下で利用可能です。
https://nokyc.appNoKYC is an independent directory of no-KYC crypto services —
exchanges, swaps, wallets, VPNs, hosting and more — each ranked by
a transparent privacy score and KYC level.
Use crypto without identity verification: no account, no tracking, browse freely on clearnet or over Tor.
まってしぬwwwww👌👈の意味をあらためて確認しに来たがほんとえっrrrrrrrrr((((殴
https://techbullion.com/buy-gold-silver-with-crypto-in-2026-the-3-best-dealers-compared/ BtcGoldsop | Buy Gold and silver
with bitcoin and cryptocurrency anonymously
https://nokyc.appNoKYC is an independent directory of no-KYC crypto services — exchanges, swaps, wallets, VPNs,
hosting and more — each ranked by a transparent privacy score and KYC level.
Use crypto without identity verification: no account, no tracking,
browse freely on clearnet or over Tor.
https://techbullion.com/buy-gold-silver-with-crypto-in-2026-the-3-best-dealers-compared/ BtcGoldsop | Buy Gold and silver
with bitcoin and cryptocurrency anonymously
https://nokyc.appNoKYC is an independent directory of no-KYC crypto services — exchanges,
swaps, wallets, VPNs, hosting and more — each ranked by a
transparent privacy score and KYC level.
Use crypto without identity verification: no account,
no tracking, browse freely on clearnet or over Tor.
過去に使用していたフエースブックアプリを再度インストールしたい。
🌷すき
太鼓の達人
アンチですか?これをかいてる人にも失礼ですし見てると不快になりますやめてくださいね🫷