From 333cfc13559d155a974eabf09a3778584e612ddc Mon Sep 17 00:00:00 2001 From: Fazle Arefin Date: Wed, 7 Aug 2024 16:14:33 +1000 Subject: [PATCH] xargs: improve example command (#13396) --- pages/common/xargs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/common/xargs.md b/pages/common/xargs.md index 3e805c51a..dc56cb1f9 100644 --- a/pages/common/xargs.md +++ b/pages/common/xargs.md @@ -12,9 +12,9 @@ `{{arguments_source}} | xargs sh -c "{{command1}} && {{command2}} | {{command3}}"` -- Delete all files with a `.backup` extension (`-print0` uses a null character to split file names, and `-0` uses it as delimiter): +- Gzip all files with `.log` extension taking advantage of multiple threads (`-print0` uses a null character to split file names, and `-0` uses it as delimiter): -`find . -name '*.backup' -print0 | xargs -0 rm -v` +`find . -name '*.log' -print0 | xargs -0 -P {{4}} -n 1 gzip` - Execute the command once per argument: