Comment

Comment by lucb1e

> Extract tar.gz in new directory: tar zxvf package.tar.gz -C new_dir

For quick reference, since it seems to be hard[1], these are the flags you'll most need in tar:

    c = create
    x = extract
    v = verbose
    z = gzipped; compressed.
    f = file
So for example `tar xf example.tar` will extract that tar file. Or `tar cf example.tar .` will pack all files in the current directory to example.tar. For compression and verbosity, it would be `tar zvcf example.tar.gz .`. The .gz at the end is optional, but now others can see what kind of archive it is. Extract .tar.gz files with `tar xzf example.tar.gz`.

For bonus points, here is a poor man's version of scp/rsync:

    # sending computer
    tar czf - . | openssl aes-128-cbc -k 'secret' | nc -l 1
    # receiving computer
    nc 192.168.1.102 1 | openssl aes-128-cbc -d -k 'secret' | tar xf -
[1] Obligatory xkcd https://xkcd.com/1168/

Edit: replaced all asterisks with a period (.) since it would become italics. Tar is recursive by default, so it should work the same.

parent lucb1e 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton