passing variables from 'ls' to 'tar' via 'xargs' ls -t | head -n 3 | xargs tar -cf t.tar Works for me. Is there a reason you need the -I flag set?