Argument receiving error for rm command

0 votes

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are approx. 60 chars.

When I try to remove them all together using rm -f *.pdf

I get the following error:

/bin/rm: cannot execute [Argument list too long]

What can I do?

Jun 7 in Linux Administration by Upasana
• 8,130 points
9 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Bash actually expands the asterisk to every matching file, producing a very long command line. That's the reason for your issue.

find . -name "*.pdf" -print0 | xargs -0 rm

This should help

answered Jun 7 by Shubham
• 12,790 points

Related Questions In Linux Administration

0 votes
1 answer

How to use help command for ls?

The help command is limited and it ...READ MORE

answered Jan 3 in Linux Administration by Omkar
• 66,880 points
115 views
0 votes
1 answer

Constraints for getting commands executed by cron

I think the problem could be those ...READ MORE

answered Nov 14, 2018 in Linux Administration by nirvana
• 3,060 points
22 views
0 votes
1 answer

How to use help command

The help command is limited and it ...READ MORE

answered Jan 10 in Linux Administration by Omkar
• 66,880 points
29 views
0 votes
1 answer

"connect: Network is unreachable?" error on ping

You need to set your default gateway. ...READ MORE

answered Jan 23 in Linux Administration by Tina
102 views
0 votes
1 answer

Error installing npm

Npm depends on NodeJS to run/get installed. ...READ MORE

answered Feb 8 in Linux Administration by Omkar
• 66,880 points
27 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,220 points
60 views
0 votes
1 answer

Linux command-line call not returning what it should from os.system?

What gets returned is the return value ...READ MORE

answered Aug 29, 2018 in Python by Priyaj
• 56,140 points
27 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.