Skip to content

Instantly share code, notes, and snippets.

@ferdaber
Created April 7, 2018 15:50
Show Gist options
  • Select an option

  • Save ferdaber/2423aab93e81c249593d2c57ade31853 to your computer and use it in GitHub Desktop.

Select an option

Save ferdaber/2423aab93e81c249593d2c57ade31853 to your computer and use it in GitHub Desktop.
Notes on xargs usages

Useful flags

  • -t outputs what it's going to perform before performing it
  • -I replaces occurrences of the argument with whatever is piped into it

Piping multiple commands

cat file.txt | xargs sh -c "<command>; <commandtwo>"

Replace with arguments

cat file.txt | xargs -I "{}" sh -c "cd {}; <command_in_dir>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment