xargs Flashcards
xargs
xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items read from standard input.
![](https://s3.amazonaws.com/brainscape-prod/system/cm/313/341/731/a_image_thumb.png?1591391667)
xargs -a file1.txt
This command will read file1.txt and displays the contents.
-a file, –arg-file=file, Read items from file instead of standard input. If this option is used stdin remains unchanged when commands are run.
xargs -p -a file1.txt
The -p option prompts for confirmation before running each command.
-p, –interactive, Prompt the user about whether to run each command line and read a line from the terminal.
xargs -L
-L max-lines, Use at most max-lines nonblank input lines per command line. Trailing blanks cause input line to be logically continued on the next input line. Implies -x.
xargs -n
-n max-args, –max-args=max-args, Use at most max-args arguments per command line.