(Vi) Linux 101 - Lệnh `xargs` bá đạo thế nào

Posted on December 27, 2022 by lk
Tags: linux, xargs

Outline

ở đây chúng ta muốn tìm các process có tên là chrome sau đó force kill các process liên quan.

ps aux | grep "chrome" | awk '{print $2}' | xargs -I$ kill -9 $

ở đây chúng ta muốn in ra các website từ trong file website.list, sau đó lấy content của từng website bằng lệnh curl.

cat /tmp/website.list | xargs -I$ -P5 sh -c 'curl -s $'

Linux 101 - Lệnh xargs bá đao thế nào ?

Tài liệu tham khảo