3
find . -type f -print0 | xargs -0 ls -ltr | head -n 10 | awk '{print $NF}' | xargs rm 

This command is giving me this:

xargs: 'ls' terminated by signal 13 

However, it's executing fine. It's supposed to delete the 10 oldest files on the specific folder. Is there something to worry about? Is there a fix?

Server is running BuildRoot.

2
  • A better way to sort files, especially lots of files - so many that xargs would issue multiple invocations of ls and you wouldn't get a total sort - can be found at unix.stackexchange.com/questions/22674/… Commented Sep 10, 2018 at 19:35
  • Signal numbers other then 1, 2, 3, 6, 9, 14, and 15 are not portable. You need to explain what signal 13 is on your local machine. Commented Sep 10, 2018 at 20:55

1 Answer 1

1

I believe the issue is with the head command and the pipe. See https://stackoverflow.com/questions/27800726/ls-terminated-by-signal-13-when-using-xargs for more information.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.