Xargs Pipeline in Shell

Level 354 keystrokes

xargs converts input into arguments for another command.

Shell code

# find lists .log files last modified more than 30 days ago, one path per line
# xargs -I {} runs rm -v once per line, putting the path where {} is
1find . -name "*.log" -mtime +30 | xargs -I {} rm -v {}

Output

removed './logs/old.log'
removed './logs/archive.log'
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • -× 4
  • .× 2
  • "× 2
  • {× 2
  • }× 2
  • *× 1
  • +× 1
  • |× 1

More Shell examples at level 3

← Shell typing practice