I doubt it would matter much.
I would use a loop, just because I don't know how many files are listed in the list file, and I don't (generally) know if any of the filenames have spaces in their names. Doing a command substitution that would generate a very long list of argument may result in an "Argument list too long" error when the length of the list generated is too long.
My loop would look like
while IFS= read -r name; do
gunzip "$name"
done <file.list
This would additionally allow me to insert commands for processing the data after the gunzip
command. In fact, depending on what the data actually is and what needs to be done with it, it may even be possible to process it without saving it to file at all:
while IFS= read -r name; do
zcat "$name" | process_data
done <file.list
(where process_data
is some pipeline that reads the uncompressed data from standard input)
If the processing of the data takes longer than the uncompressing of it, the question of whether a loop is more efficient or not becomes irrelevant.
Ideally, I would prefer to not work off a list of filenames though, and instead use a filename globbing pattern, as in
for name in ./*.gz; do
# processing of "$name" here
done
where ./*.gz
is some pattern that matches the relevant files. This way we are not depending on the number of files nor on the characters used in the filenames (they may contain newlines or other whitespace characters, or start with dashes, etc.)
Related:
gzip
on your system, the number of files in the file list and the size of those files.xargs gzip -d < large_file_list
but watch out for spaces in filenames, maybe withtr \\n \\0 large_file_list | xargs -0 gzip -d