Skip to content

Instantly share code, notes, and snippets.

@guipacheco2
Last active August 29, 2015 13:58
Show Gist options
  • Save guipacheco2/9997878 to your computer and use it in GitHub Desktop.
Save guipacheco2/9997878 to your computer and use it in GitHub Desktop.
Unix

$ tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog

$ tar -zxvf prog-1-jan-2005.tar.gz

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

$ rsync -avhW --no-compress --progress /src/ /dst/

-a is for archive, which preserves ownership, permissions etc.

-v is for verbose, so I can see what's happening (optional)

-h is for human-readable, so the transfer rate and file sizes are easier to read (optional)

-W is for copying whole files only, without delta-xfer algorithm which should reduce CPU load

--no-compress as there's no lack of bandwidth between local devices

--progress so I can see the progress of large files (optional)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment