60 の一般的な rsync コマンドとその説明

以下は、一般的に使用される 60 個の rsync コマンドとその説明です。

  1. rsync source_dir destination_dir: ソース ディレクトリ内のファイルとフォルダーをターゲット ディレクトリに同期します。
  2. rsync -a source_dir destination_dir: ファイルの属性と権限を維持しながら、アーカイブ モードでディレクトリを同期します。
  3. rsync -v source_dir destination_dir: 同期処理の詳細情報を出力します。
  4. rsync -r source_dir destination_dir: ディレクトリとそのサブディレクトリを再帰的に同期します。
  5. rsync -z source_dir destination_dir:圧縮機能を有効にしてデータ送信量を削減します。
  6. rsync -c source_dir destination_dir: チェックサムを比較することにより、ファイルが変更されたかどうかを検出します。
  7. rsync --delete source_dir destination_dir: ソース ディレクトリに存在しない、ターゲット ディレクトリ内のファイルを削除します。
  8. rsync --exclude='pattern' source_dir destination_dir: 指定したパターンに一致するファイルまたはフォルダーを除外します。
  9. rsync --exclude-from='file' source_dir destination_dir: 指定されたファイルから除外パターンを読み取り、同期します。
  10. rsync --include='pattern' source_dir destination_dir: 指定したパターンに一致するファイルまたはフォルダーのみを含めます。
  11. rsync --include-from='file' source_dir destination_dir: 指定されたファイルからインクルード パターンを読み取り、同期します。
  12. rsync --progress source_dir destination_dir: 同期の進行状況と速度情報を表示します。
  13. rsync --dry-run source_dir destination_dir: 同期操作をシミュレートし、発生する変更を表示しますが、実際には実行しません。
  14. rsync --bwlimit=KBPS source_dir destination_dir: 帯域幅の使用量を KB/秒単位で制限します。
  15. rsync --size-only source_dir destination_dir:ファイルサイズのみで同期が必要かどうかを判断します。
  16. rsync --checksum source_dir destination_dir: 完全なチェックサムを強制することにより、同期が必要かどうかを判断します。
  17. rsync --delete-excluded source_dir destination_dir--exclude:と を併用した--delete場合、除外ファイルを削除します。
  18. rsync --backup source_dir destination_dir: ターゲット ディレクトリに既に存在するファイルをバックアップします。
  19. rsync --backup-dir=DIR source_dir destination_dir: ターゲット ディレクトリ内の既存のファイルを指定したディレクトリにバックアップします。
  20. rsync --link-dest=DIR source_dir destination_dir: 既存のファイルへのハード リンクを作成して、スペースの使用量を削減します。
  21. rsync --ignore-existing source_dir destination_dir: ターゲット ディレクトリにすでに存在するファイルを無視します。
  22. rsync --timeout=TIME source_dir destination_dir:接続タイムアウトを設定します。
  23. rsync --progress --partial source_dir destination_dir: リアルタイムの進行状況を表示しながら、中断後の再送信を許可します。
  24. rsync -n --itemize-changes source_dir destination_dir: 発生する変更の詳細なリストを表示しますが、実際にはアクションは実行されません。
  25. rsync -a --exclude='pattern1' --exclude='pattern2' source_dir destination_dir:複数のパターンでファイルやフォルダーを除外します。
  26. rsync -avzP source_dir remote_server:destination_dir: ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期します。
  27. rsync -a --delete source_dir remote_server:destination_dir: ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期し、リモート ディレクトリに存在しないファイルを削除します。
  28. rsync -a --dry-run --delete source_dir destination_dir: 同期操作をシミュレートし、ターゲット ディレクトリ内の削除対象のファイルを表示します。
  29. rsync -a --exclude-from='file' source_dir remote_server:destination_dir: 指定されたファイルから除外パターンを読み取り、ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期します。
  30. rsync -rltDv source_dir remote_server:destination_dir: ディレクトリを同期し、ディレクトリ構造と権限を維持しますが、ファイル属性は同期しません。
  31. rsync -avz --include='*.txt' --include='*.doc' --exclude='*' source_dir destination_dir: 指定されたタイプのファイルのみを同期し、他のすべてのファイルを除外します。
  32. rsync -a --filter=':- .gitignore' source_dir destination_dir: .gitignore ファイルで定義されたフィルタリング ルールを使用して同期します。
  33. rsync -a --link-dest=DIR --backup-dir=DIR source_dir destination_dir: 既存のファイルへのハード リンクを作成し、指定したディレクトリにバックアップします。
  34. rsync -a --exclude='.git/' source_dir destination_dir:.git フォルダーとその内容を除外します。
  35. rsync -a --max-size='100K' source_dir destination_dir: 100KB 未満のファイルのみを同期します。
  36. rsync -a --min-size='1M' source_dir destination_dir: 1MB を超えるファイルのみを同期します。
  37. rsync -av --bwlimit=500 source_dir destination_dir: 同期中の帯域幅使用量を 500 KB/秒に制限します。
  38. rsync -a --include='*/' --exclude='*' source_dir destination_dir: フォルダーのみを同期し、ファイルを無視します。
  39. rsync -a --prune-empty-dirs source_dir destination_dir: 空のフォルダーを無視します。
  40. rsync -avzP --log-file='log.txt' source_dir destination_dir: 同期プロセスの情報を指定したログ ファイルに記録します。
  41. rsync -a --exclude='*.txt' --delete-excluded source_dir destination_dir: すべての .txt ファイルを除外し、ターゲット ディレクトリ内の除外されたファイルを削除します。
  42. rsync -a --link-dest=DIR --exclude='*.txt' source_dir remote_server:destination_dir: ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期し、既存のファイルへのハード リンクを作成します。ただし、すべての .txt ファイルは除外されます。
  43. rsync -a --include='*.txt' --exclude='*.doc' source_dir remote_server:destination_dir: .txt ファイルのみを同期し、.doc ファイルを除外し、ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期します。
  44. rsync -a --exclude='*.txt' --exclude='exclude_folder/' source_dir remote_server:destination_dir: すべての .txt ファイルとexclude_folder/フォルダーを除外し、ソース ディレクトリをリモート サーバー上のターゲット ディレクトリに同期します。
  45. rsync -n --exclude-from='exclude.txt' source_dir destination_dir: 指定されたファイルから除外パターンを読み取り、同期操作をシミュレートしますが、実際には実行しません。
  46. rsync -a --exclude='pattern' --delete-excluded source_dir remote_server:destination_dir: 指定されたパターンに一致するファイルまたはフォルダーを除外し、リモート サーバー上のターゲット ディレクトリ内の除外されたファイルを削除します。
  47. rsync -a --ignore-existing --size-only source_dir destination_dir: ターゲット ディレクトリに既に存在するファイルを無視し、ファイル サイズのみで同期が必要かどうかを判断します。
  48. rsync -a --remove-source-files source_dir destination_dir: 同期後にソース ディレクトリ内の同期ファイルを削除します。
  49. rsync -a --filter='P /pattern/' source_dir destination_dir: 正規表現パターンを含むカスタム フィルタリング ルールを使用して同期します。
  50. rsync -a --filter='R /pattern/' source_dir destination_dir: 拡張正規表現パターンを含むカスタム フィルタリング ルールを使用して同期します。
  51. rsync -a --filter='S /from/to/' source_dir destination_dir: 文字列置換ルールを含むカスタム フィルタリング ルールを使用して同期します。
  52. rsync -a --filter='A /from/to/' source_dir destination_dir: グローバル文字列置換ルールを含むカスタム フィルタリング ルールを使用して同期します。
  53. rsync -a --chmod=MODE source_dir destination_dir: 指定された権限モードに従って、同期後のターゲット ファイルの権限を設定します。
  54. rsync -a --chown=USER:GROUP source_dir destination_dir: 指定したユーザーとグループに従って、同期後のターゲット ファイルの所有者を設定します。
  55. rsync -a --exclude='pattern' --exclude-from='file' --delete-excluded source_dir destination_dir: 複数のパターンでファイルまたはフォルダーを除外し、指定されたファイルから除外パターンを読み取り、対象ディレクトリ内の除外されたファイルを削除します。
  56. rsync -a --include='pattern' --include-from='file' --exclude='*' source_dir destination_dir: 指定されたパターンに一致するファイルまたはフォルダーのみをインクルードし、他のすべてのファイルを除外しながら、指定されたファイルからインクルード パターンを読み取ります。
  57. rsync -a --skip-compress=EXT source_dir destination_dir: 指定した拡張子のファイルの圧縮をスキップします。
  58. rsync -a --modify-window=SECONDS source_dir destination_dir: FAT ファイル システムのタイムスタンプの問題を処理するには、タイム ウィンドウ サイズを変更します。
  59. rsync -a --backup-dir=DIR --suffix=STRING source_dir destination_dir: 既存のファイルを指定したディレクトリにバックアップし、カスタム サフィックスを追加します。
  60. rsync --version:rsyncのバージョン情報を表示します。

これらのコマンドとオプションは、最も一般的なファイル同期のニーズを満たすことができ、特定の状況に応じて適切なコマンドを選択できます。rsync コマンドを使用するときは、重要なデータを誤って同期したり削除したりしないように、コマンド パラメーターを必ず注意深く確認してください。

おすすめ

転載: blog.csdn.net/m0_55877125/article/details/132754048