{
  "id": 14730139,
  "title": "Notes on the tar + ssh pipe technique",
  "url": "https://urgent.news/2026/10/15/notes-on-the-tar-ssh-pipe-technique",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-15T15:40:48.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/kohei_wada/notes-on-the-tar-ssh-pipe-technique-49b9"
  },
  "original_language": "en",
  "account": "The tar + ssh pipe technique provides a versatile solution for transferring files when rsync or scp are not available. To pull files from a remote server, the syntax is ssh host sudo tar cz /path/to/dir | tar xz. For pushing files to a remote server, use tar cz . | ssh host tar xz -C /path/to/dest. This method compresses files on the fly to save bandwidth and avoids creating temporary files on the remote machine. When using sudo, the command ssh host sudo tar cz /var/log/nginx | tar xzv --strip-components=3 extracts the files without leaving a temp file on the remote server. The --strip-components flag removes the first three path components, resulting in the files being extracted as nginx/. The extraction target can be chosen by specifying the destination with -C on the extracting side of the pipe.",
  "summary": "I can never quite recall the exact command when I actually need it, so I'm parking it here for copy-paste. TL;DR (for the impatient) # Pull from remote to local (with sudo) ssh host \"sudo tar cz /var/log/nginx\" | tar xzv --strip-components = 3 # Push from local to remote tar cz . | ssh host \"tar xz -C /path/to/dest\" What happened I needed to pull logs off an old CentOS server. Tried rsync: -bash:…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}