Understanding xargs
xargs [options] [command [initial-arguments]]
Linux is an OS that has been developed and oriented to provide users simple commands which can be joined to do
Xarg is one of those commands that allows you to compose routines that would be tedious in some other way.
The logic of xarg is the same as a while loop that gets as input the result of a previous command by default using both spaces and newlines as delimiters. For instance, imagine you have to change read permissions of all files in a directory from root to otheruser. You can change them one by one, but it seems not a very enjoyable task, especially if there are a lot of. It would be great if you could filter the files you need and then change their permissions. Here is when xargs comes into action.
I guess you already know how to select files by the owner and then change
find . -user root
This should prompt all the files owned by root in the current directory and subdirectories. Now with the xargs
chown otheruser {here will be placed each result of previous command}
Now we only have to connect
find . -user root | xargs sudo chown otheruser
xargs, the backtick and the dollar syntax
Dollar syntax and backtick
command1 `command2` = command1 $(command2)
Where
The critical difference between backtick and xargs is that backtick syntax
Either you can’t put arguments to each iteration
And