Shell Xargs
# Basic syntax:
<command_1> | xargs <command_2>
# Where:
# - the stdout of command_1 gets piped to xargs which executes command_2 on
# every space, tab, or new-line delimited input
# Note:
# - this is similar to find..exec, but xargs is faster and more versatile
# - xargs allows tools like rm to accept standard input as arguments
# Example usage:
# Say you want to change the permissions of all directories and subdirectories
# of the current directory. You can run:
find . -type d | xargs chmod 777
# Note:
# - the -t flag causes xargs to print each command that will be executed
# to the terminal, which is useful for debugging
# - the -p flag will print the command to be executed and prompt the
# user to run it, which is also useful for debugging
Charles-Alexandre Roy