0 like 0 dislike
17 views
asked in Software by (4.7k points)

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

tar compress list of files

Your answer

pre, code

Preview

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 (4.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 14 views
0 like 0 dislike
1 answer 17 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
1 answer 24 views
0 like 0 dislike
1 answer 23 views
0 like 0 dislike
1 answer 10 views
0 like 0 dislike
1 answer 5 views
0 like 0 dislike
1 answer 21 views
...