# xargs Il comando xargs legge righe di testo dallo standard input o dall'output di un altro comando e le esegue. In altre parole, consente all'utente di eseguire righe di comando dallo standard input. ## Sintassi La sintassi generale di xargs è: ```bash xargs [opzioni] [comando [arg1 …] ] ``` ## Utilizzo [https://noviello.it/come-creare-ed-eseguire-comandi-dallinput-standard-su-linux-xargs/](https://noviello.it/come-creare-ed-eseguire-comandi-dallinput-standard-su-linux-xargs/) L'esempio più basilare di utilizzo del comando xargs sarebbe quello di passare diverse stringhe ed eseguire un comando che userà quelle stringhe come argomenti. ```bash echo "file1 file2 file3" | xargs touch ``` Nell'esempio sopra, il comando touch viene eseguito per ogni argomento, creando tre file. Un ulteriore esempio: ```bash $ ls 1.txt 2.txt 3.txt $ ls | xargs cat this is file1 this is file2 this is file3 ``` Per vedere il comando che xargs sta eseguendo, utilizzare l'opzione `-t`. ```bash $ ls | xargs -t cat cat 1.txt 2.txt 3.txt this is file1 this is file2 this is file3 ``` ## Collegamenti - [https://linuxhandbook.com/xargs-command/](https://linuxhandbook.com/xargs-command/) - [https://it.wikipedia.org/wiki/Xargs](https://it.wikipedia.org/wiki/Xargs) - [https://www.howtogeek.com/435164/how-to-use-the-xargs-command-on-linux/](https://www.howtogeek.com/435164/how-to-use-the-xargs-command-on-linux/) - [https://it.linux-console.net/?p=10733](https://it.linux-console.net/?p=10733)