Shell command/script to delete files whose names are in a text file

Try this command:

rm -f $(<file)

For fast execution on macOS, where xargs custom delimiter d is not possible:

<list.txt tr "\n" "\0" | xargs -0 rm

while read -r filename; do
  rm "$filename"
done <list.txt

is slow.

rm $(<list.txt)

will fail if there are too many arguments.

I think it should work:

xargs -a list.txt -d'\n' rm

If the file names have spaces in them, none of the other answers will work; they'll treat each word as a separate file name. Assuming the list of files is in list.txt, this will always work:

while read name; do
  rm "$name"
done < list.txt