5 Matching Annotations
  1. Sep 2021
    1. One good use for /dev/tty is if you're trying to call an editor in a pipeline (e.g., with xargs). Since the standard input of xargs is some list of files rather than your terminal, just doing, e.g., | xargs emacs will screw up your terminal. Instead you can use | xargs sh -c 'emacs "$@" </dev/tty' emacs to connect the editor to your terminal even though the input of xargs is coming from elsewhere.
  2. Dec 2020
    1. Here we used two xargs commands. The first one builds a custom command line, using as input the output of the previous command in the pipe (being pidof sleep) and the second xargs command executes that generated, custom-per-input (important!), command.

      xargs | xargs

  3. Aug 2020
    1. The easiest way to do what the original poster wants is to change the delimiter from any whitespace to just the end-of-line character like this: find whatever ... | xargs -d "\n" cp -t /var/tmp
    2. Speed example -- over 829 files, the "find -exec" method took 26 seconds while the "find -print0 | xargs --null" method tool 0.7 seconds. Significant difference.
  4. Apr 2020