tar Functions
The ever-ready Tape Archive tool, still handy in 2024.
tarCreate
Platform agnostic tar cfz which ignores owner and attributes
Usage
tarCreate target files
Platform agnostic tar cfz which ignores owner and attributes
tar command is not cross-platform so this differentiates between the GNU and BSD command line arguments without needing to know what operating system you are on. Creates a gz-compressed tar file (.tgz or .tar.gz) with user and group set to 0 and no extended attributes attached to the files.
Short description: Platform agnostic tar create which keeps user and group as user 0
Arguments
target- The tar.gz file to createfiles- A list of files to include in the tar file
Return codes
0- Success1- Environment error2- Argument error
tarExtractPattern
Platform agnostic tar extract with wildcards
Usage
tarExtractPattern pattern
Platform agnostic tar extract with wildcards
e.g. tar -xf '*/file.json' or tar -xf --wildcards '*/file.json' depending on OS
tar command is not cross-platform so this differentiates between the GNU and BSD command line arguments.
Short description: Platform agnostic tar extract
Reads standard input
A gzipped-tar file
Writes to standard output
The desired file
Arguments
pattern- The file pattern to extract
Return codes
0- Success1- Environment error2- Argument error