The Source of the Picture and the Origin of the Story: Solving the ‘Argument List Too Long’ Error in Linux

2023-08-13 22:52:58
The source of the picture… The origin of the story… The source of the picture… First, let’s check how many files are in the target directory, but the result is… # Check how many files are there ll *.txt|wc -l# Tragedy happened… -bash: /usr/bin/ls: Argument list too long Then we try to move the file? # Move the file to the upper directory mv *.txt ../# Do not move the same -bash: /usr/bin/mv: Argument list too long Tried “cp, rm”… and other commands also got the same result , why is this so? Let’s track down why! The main reason for this is that the parameter passed to the system command is too long, and the Linux system itself has a limit to avoid too long, so it is a policy of guard inspection. Interested friends can refer to “argmax”, here is a detailed description. Solution There are mainly two solutions: find /path/to/files -type f -name “*.txt” | xargs rmfind /path/to/files -type f -name “*.txt” -exec rm \;Conclusion Although the Linux system has a relatively high threshold, users are also very willing to share the situations encountered and how to deal with them, so basically there is no need to be afraid of this system, and the processing efficiency is relatively good, especially when we develop cloud services Linux skills are very much needed when running applications, so you might as well study hard to keep up with the trend of the times. If you like to write articles, you might as well take a look at it: an exclusive win-win platform for creators and readers in the era of Web3.0—why join?Welcome to join us to practice writing and earn knowledge
1691977298
#Linux #intractable #diseasesArgument #list #long #solution

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.