How to resolve the '/bin/rm: Argument list too long' error कैसे '/ बिन rm / हल करने के लिए: तर्क भी' लंबे समय त्रुटि सूची

by Sukrit Dhandhania on February 18, 2009 Sukrit Dhandhania द्वारा 18 फ़रवरी 2009 को

लिनक्स

root@dwarf /var/spool/clientmqueue # rm spam-* बौना @ रूट / var / स्पूल / clientmqueue # rm स्पैम-*
/bin/rm: Argument list too long. / bin / rm: तर्क की सूची भी लंबी है.

Ever seen this error in Linux when you have too many files in a directory and you are unable to delete them with a simple rm -rf * ? कभी लिनक्स में इस त्रुटि को देखा है जब तुम एक निर्देशिका में बहुत अधिक फ़ाइलें है और तुम एक साधारण rm-आरएफ * के साथ उन्हें नष्ट करने में असमर्थ रहे हैं? I have run into this problem a number of times. मैं इस समस्या में चला है कई बार. After doing a bit of research online I came across a neat solution to work around this issue. अनुसंधान के बाद ऑनलाइन के एक बिट कर मैं एक साफ समाधान के लिए चारों ओर इस मुद्दे पर काम भर आया था.

find . ढूँढना. -name 'spam-*' | xargs rm 'नाम स्पैम' * | rm xargs

In the above instance the command will forcefully delete all files in the current directory that begin with spam- . उपरोक्त उदाहरण के आदेश जबरदस्ती मौजूदा निर्देशिका में सभी फ़ाइलें कि स्पैम के साथ शुरू नष्ट करेगा. You can replace the spam-* with anything you like. आप स्पैम की जगह, कुछ के साथ * आपको पसंद है. You can also replace it with just a * if you want to remove all files in the folder. तुम भी यह सिर्फ एक अगर तुम चाहो तो फ़ोल्डर में सभी फ़ाइलें * हटाने के साथ बदल सकते हैं.

find . ढूँढना. -name '*' | xargs rm -rm 'नाम' * | xargs

We have covered the हम कवर किया Linux find लिनक्स खोज command in great detail earlier. बड़े विस्तार से पहले कमान. Xargs Xargs is Linux command that makes passing a number of arguments to a command easier. लिनक्स आदेश है कि एक कमांड में बहस के लिए कई गुजर आसान बनाता है.

Related Posts: संबंधित पोस्ट:
  • How to install and manage packages in Linux with RPM और कैसे स्थापित करने के लिए RPM के साथ लिनक्स में संकुल प्रबंधन
  • Windows XP Recovery System Features Windows XP पुनर्प्राप्ति प्रणाली रूप
  • Technology and Lifestyle प्रौद्योगिकी और लाइफस्टाइल
  • How to resolve Windows Vista Update error 800B0100 कैसे Windows Vista अद्यतन त्रुटि 800B0100 हल करने के लिए
  • Pownce overview and 10 invites for Simplehelp Readers Pownce सिंहावलोकन और 10 Simplehelp पाठकों के लिए आमंत्रित
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! बस अपने ईमेल इनबॉक्स के लिए मुफ्त हर दिन - में यह एक तरह सरल सहायता ट्यूटोरियल जाओ! Just enter your email address below: जरा नीचे अपने ईमेल पते दर्ज करें:

    You can always opt out of this email subscription at any time. तुम हमेशा इस ईमेल सदस्यता से बाहर किसी भी समय विकल्प चुन सकते हैं.

    { 3 comments… read them below or (3 टिप्पणियाँ ... उन्हें या नीचे पढ़ें add one एक जोड़ } )

    1 1 Aleš Friedl 02.19.09 at 7:16 am एल्स 7:16 पर Friedl 02.19.09 हूँ

    Safe variant for filenames with spaces, new lines and other whitespace characters: रिक्त स्थान, नई लाइनें और अन्य रहितसफेद अक्षर के साथ filenames के लिए सुरक्षित संस्करण:
    find . ढूँढना. -name '*' -print0 | xargs -o rm 'नाम *' print0-| xargs-o rm

    2 2 MikeT 02.19.09 at 6:30 pm 6:30 पर MikeT 02.19.09

    Good catch using the print0 option, that's an important one. अच्छी पकड़ print0 विकल्प का उपयोग करते हुए, कि एक महत्वपूर्ण एक है.

    Most find commands do not require the “-name” predicate. ज्यादातर कमांड 'नाम विधेय "की आवश्यकता नहीं है लगता है. What's usually more important is to make sure you're deleting *files* and not something else you might not have intended. क्या आम तौर पर और अधिक महत्वपूर्ण है सुनिश्चित करें कि आप को नष्ट कर रहे हैं * * तुम कुछ और करना नहीं सकता फाइल नहीं बना है. For this use “-type f” inplace of the “-name” option…. इस का उपयोग करें 'के लिए-प्रकार' नाम "विकल्प की inplace च" ....

    find . ढूँढना. -type f -print0 | xargs -0 /bin/rm -प्रकार एफ print0 | xargs -0 / bin / rm

    A) Use the full path to the 'rm' command so your aliases don't muck with things. ए) '' rm को पूरा रास्ता कमांड का प्रयोग करें तो अपने उपनाम के साथ गोबर के लिये की बातें नहीं करते.
    B) Check your xargs command, you can sometimes, if needed, tell it to use one “result” at a time, such as (if you didn't use print0 but regular print) “-l1″ बी) आपके xargs कमान की जाँच करें, आप कभी कभी, अगर जरूरत थी, यह बता सकते हैं ऐसे एक परिणाम के रूप में "एक समय में," का उपयोग करें (यदि आप print0 पर नियमित रूप से प्रिंट उपयोग नहीं) था 'L1 "

    3 3 myhnet myhnet 02.25.09 at 12:12 am 12:12 पर 02.25.09 हूँ

    find . ढूँढना. -type f -exec rm {} \; -प्रकार-exec rm च \ ();

    Leave a Comment एक टिप्पणी छोड़ दो

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> आप ये HTML टैग और विशेषताएँ: <a href="" उपयोग title=""> <abbr title=""> <acronym कर सकते हैं <blockquote title=""> <b> cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>