Explain the command ls -1tr | head -n -10 | xargs -d '\n' rm -f --

The command is from the post on http://superuser.com/questions/268344/how-do-i-delete-all-but-10-newest-files-in-linux
ls -1tr | head -n -10 | xargs -d '\n' rm -f --

Open in new window

What does the last
--

Open in new window

stands for in this command?
Taras ShumyloAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SniperCode ShevaCommented:
As always, you should read a command's manpage to find out how it interprets its arguments.

-- is commonly used to indicate the end of the command options. This is especially useful if you want to pass a filename or other argument that begins with -. It's also a good idea to use it before wildcards that might expand to a filename beginning with a hyphen. (For example, try mkdir foo; cd foo; echo >-l; ls *; ls -- *.)

But git diff also uses it to indicate whether an argument is a <commit> (indicating what revision to diff) or a <path> (indicating which file to diff). It can usually guess, but it's possible for a value to be both a valid commit and a valid path. In that case, you can use git diff foo -- to indicate that foo is a commit, or git diff -- foo to indicate that foo is a path.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Taras ShumyloAuthor Commented:
I open man page for xargs and can not find anything about
--

Open in new window

Why it's not on man page?
0
gheistCommented:
if you open page for rm you see it.
0
gheistCommented:
imagine deleting files \* and \-rf .... One who wrote the command did very good...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.