Xargs commands for Linux

Source: Internet
Author: User
For details about Linux commands, xargs is a very powerful command. you can use the output of one command as the parameter of another command. The following are some examples of how to effectively use the xargs command. 1. when you use the rm command to delete many files, you may get an error message :...
For details about Linux commands, xargs is a very powerful command. you can use the output of one command as the parameter of another command. The following is an example of how to effectively use the xargs command. when you use the rm command to delete many files, you may get the error message "/bin/rm Argument list too long-Linux ". At this time, xargs can be used to avoid this problem www.2cto.com find ~ -Name parameters *. log'-print0 | xargs-0 rm-f to obtain all files ending with. conf in/etc. You can obtain the following results in multiple ways. The following command is only used to help you understand how to use the xargs. find command to pass the input result one by one to xargs as the ls-l parameter. # Find/etc-name "*. conf "| xargs ls-l when you want to download some URLs, these URLs are saved in a file, you can use the xargs command # cat url-list.txt | xargs wget-c to find all .jpg format images and archive them. Www.2cto.com # find/-name *. jpg-type f-print | xargs tar-cvzf images.tar.gz copy all jpg image files to an external hard disk # ls *. jpg | xargs-n1-I cp {}/external-hard-drive/directory
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.