asked in Software by (6.6k points)
0 like 0 dislike
27 views

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

tar compress list of files

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.

1 Answer

0 like 0 dislike
answered by (6.6k 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

Related questions

0 like 0 dislike
1 answer 20 views
0 like 0 dislike
1 answer 33 views
0 like 0 dislike
1 answer 19 views
0 like 0 dislike
1 answer 34 views
0 like 0 dislike
1 answer 43 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 47 views
0 like 0 dislike
1 answer 52 views
0 like 0 dislike
1 answer 12 views
...