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. लिनक्स आदेश है कि एक कमांड में बहस के लिए कई गुजर आसान बनाता है.























{ 3 comments… read them below or (3 टिप्पणियाँ ... उन्हें या नीचे पढ़ें add one एक जोड़ } )
Safe variant for filenames with spaces, new lines and other whitespace characters: रिक्त स्थान, नई लाइनें और अन्य रहितसफेद अक्षर के साथ filenames के लिए सुरक्षित संस्करण:
find . ढूँढना. -name '*' -print0 | xargs -o rm 'नाम *' print0-| xargs-o rm
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 "
find . ढूँढना. -type f -exec rm {} \; -प्रकार-exec rm च \ ();
Leave a Comment एक टिप्पणी छोड़ दो