The snippet library.
Small, practical examples. Search by task or narrow things down below.
Append a new member to an uncompressed tar
Linux Commands: Use tar -r for an existing uncompressed archive; compressed tar files cannot be appended this way.
Linux Commands✓ Tested
Archive filenames safely with null delimiters
Linux Commands: Use find -print0 with tar --null to preserve spaces and embedded newlines in filenames.
Linux Commands✓ Tested
Check the integrity of a gzip stream
Linux Commands: Use gzip -t to verify a compressed file without extracting it.
Linux Commands✓ Tested
Compress a stream to a chosen filename
Linux Commands: Use gzip -c to leave the source file untouched and choose the destination explicitly.
Linux Commands✓ Tested
Create an archive from an explicit file list
Linux Commands: Use tar -T for a controlled list of relative archive members.
Linux Commands✓ Tested
Exclude generated files from an archive
Linux Commands: Place exclude options before the input paths to control archive membership.
Linux Commands✓ Tested
Read concatenated gzip members
Linux Commands: GNU gzip decompresses concatenated gzip members in order.
Linux Commands✓ Tested
Read one archived file to standard output
Linux Commands: Use tar -O with an explicit member name instead of writing files to disk.
Linux Commands✓ Tested
Remove a leading directory while extracting
Linux Commands: Use strip-components only after inspecting a trusted archive layout.
Linux Commands✓ Tested
Verify a file against a checksum manifest
Linux Commands: Use sha256sum -c with a manifest obtained from a trusted source.
Linux Commands✓ Tested