in Software by (10.3k points)
0 like 0 dislike

How I can to compress list of certain files by tar archiver?

tar compress list of files

1 Answer

0 like 0 dislike
by (10.3k points)

If you want to tar all files listed in filename.list, use the tar -T filename.list command.

From the tar manpage:

-T, --files-from FILE - get names to extract or create from FILE

Using -T will prevent you from getting the error: "-bash: /bin/tar: Argument list too long" if you try to compress a large number of files.

In order to prevent recursive compression of directories, use the --no-recursion flag. The final command:

tar -pcf filename.tgz -T filename.list --no-recursion

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.