linux - How to remove X files in unix -


how following command? following pseudocode have:

ls -u | head -4 < rm * 

i want delete below 4 files

ubuntu@ip:/tmp$ ls -u | head -4 c9e5aff2-f4f6-459e-9752-466625165fa0.jpg 815626f8-2650-4596-94b9-796a82780390.jpg b9259a6b-b421-4b64-ba4d-72fd632703a3.jpg 78c243e7-43df-417d-9dcf-a4578f1c1f20.jpg 

xargs should trick:

$ ls -u | head -4 | xargs rm 

Comments