Skip to content

Linux & shell: Archives & copying

4 Linux & shell commands: Archives & copying. Click a command to see what each part does.

Index
4 items
Click a command to see what each part does.

Archives & copying4

  • tar -czvf <name>.tar.gz <dir>Create a gzip tarball

    What each part does

    1. -ccreate an archive
    2. -zcompress with gzip
    3. -vlist files as they are added
    4. -f <name>.tar.gzarchive file name (must come right after f)
  • tar -xzvf <name>.tar.gz -C <dest>Extract a tarball into a folder

    What each part does

    1. -xextract
    2. -z -v -fgzip, verbose, archive file
    3. -C <dest>change to <dest> before extracting
  • rsync -avzn --delete <src>/ <user>@<host>:<dest>/Sync a folder to a server (preview first)Caution

    What each part does

    1. -aarchive mode: recursive, keep permissions, times, owner, symlinks
    2. -vverbose
    3. -zcompress during transfer
    4. -ndry run: show what would change. Remove it to really sync
    5. --deletedelete files on the destination that are not in the source
    6. <src>/trailing slash = copy the folder’s contents, not the folder itself
  • scp -r -P <port> <src> <user>@<host>:<path>Copy a folder to a server over SSH

    What each part does

    1. -rcopy directories recursively
    2. -P <port>SSH port (capital P; lowercase -p means preserve times)
    3. <user>@<host>:<path>remote destination

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…