0 like 0 dislike
25 views
asked in Software by (5.7k points)

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 (5.7k 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 28 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
1 answer 38 views
0 like 0 dislike
1 answer 17 views
0 like 0 dislike
1 answer 35 views
0 like 0 dislike
1 answer 46 views
0 like 0 dislike
1 answer 12 views
0 like 0 dislike
1 answer 9 views
...