rsync:ko

RSYNC

rsync 는 로컬과 원격 사이에서 파일 차이만 계산해 효율적으로 복사하고 동기화하는 도구다.

rsync [OPTION]... SRC [SRC]... DEST
rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
rsync [OPTION]... [USER@]HOST:SRC [DEST]
  • rsync [<options>…] SRC DEST
    • SRC: 복사할 원본 파일 또는 디렉터리
    • DEST: 대상 파일, 디렉터리, 또는 원격 경로
  • rsync [<options>…] LOCAL_PATH USER@HOST:DEST: 로컬에서 원격으로 push
  • rsync [<options>…] USER@HOST:SRC LOCAL_PATH: 원격에서 로컬로 pull
  • -a, –archive: 재귀 복사와 권한, 시간 등 주요 메타데이터 보존
  • -v, –verbose: 상세 출력
  • -z, –compress: 전송 중 압축
  • -n, –dry-run: 실제 변경 없이 계획만 확인
  • –delete: 대상에만 있는 파일 삭제
  • –delete-before, –delete-during, –delete-after: 삭제 시점 제어
  • –exclude PATTERN: 제외 패턴 지정
  • –exclude-from FILE: 제외 규칙 파일 사용
  • –partial: 중간 전송 파일 유지
  • –progress: 파일별 진행률 표시
  • -P: –partial –progress 축약
  • -e COMMAND: 원격 shell 지정, 예: SSH 옵션 전달
  • –rsync-path PROGRAM: 원격에서 실행할 rsync 경로 지정
  • -i, –itemize-changes: 변경 요약 코드 출력
rsync -av --progress ./src/ ./dst/
rsync -av --dry-run --delete ./dokuwiki/ user@example.com:public_html/
rsync -av -e "ssh -p 65002 -i ~/.ssh/id_codex" ./dokuwiki/ user@example.com:public_html/
rsync -av -e "ssh -p 65002 -i ~/.ssh/id_codex" user@example.com:public_html/ ./dokuwiki/
  • 디렉터리 끝의 / 는 내용만 복사할지 디렉터리 자체를 복사할지에 영향을 준다.
  • –delete 는 대상에만 있는 파일을 지우므로 먼저 –dry-run 으로 확인하는 편이 안전하다.
rsync -av \
  -e "ssh -p 65002 -i ~/.ssh/id_codex -o StrictHostKeyChecking=accept-new" \
  ./dokuwiki/ \
  u613600155@31.220.110.253:public_html/

이 저장소의 Hostinger 동기화 스크립트는 위와 비슷한 SSH 기반 rsync 호출을 감싼 wrapper 다.

  • 권한 오류가 나면 SSH 키, 원격 경로, 포트를 먼저 확인한다.
  • 전송 결과가 예상과 다르면 경로 끝 / 유무를 다시 본다.
  • 삭제가 과도하게 잡히면 –dry-run–itemize-changes 로 대상 목록을 먼저 확인한다.
  • 원격 rsync 경로가 다르면 –rsync-path 를 사용한다.
  • [USER@]HOST:PATH 형식은 remote shell, 보통 SSH를 사용한다.
  • [USER@]HOST::MODULE 또는 rsync:// 형식은 rsync daemon 방식이다.
  • 이 저장소 운영 방식은 daemon 보다는 SSH transport 를 사용한다.
  • 이 저장소에서는 Hostinger 동기화 기준이 rclone bisync 에서 SSH 기반 rsync 로 이동했다.

+ rsync --help

rsync  version 3.1.3  protocol version 31
Usage: rsync [OPTION]... SRC [SRC]... DEST
  or   rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
  or   rsync [OPTION]... [USER@]HOST:SRC [DEST]
 
Options
 -a, --archive               archive mode; equals -rlptgoD
 -v, --verbose               increase verbosity
 -z, --compress              compress file data during the transfer
 -n, --dry-run               perform a trial run with no changes made
 -e, --rsh=COMMAND           specify the remote shell to use
     --delete                delete extraneous files from destination dirs
     --exclude=PATTERN       exclude files matching PATTERN
     --exclude-from=FILE     read exclude patterns from FILE
     --progress              show progress during transfer
 -P                          same as --partial --progress
 -i, --itemize-changes       output a change-summary for all updates
(-h) --help                  show this help

+

  • codex:: 2026-06-17 Created rsync reference page with SSH sync examples and core options.
  • /home/u613600155/domains/cli.zerotymer.net/public_html/data/pages/rsync/ko.txt
  • 마지막으로 수정됨: 2026/06/17 03:33
  • (바깥 편집)