From Search for and remove files safely
locate -i nohup.out | xargs -d '\n' -L1 -p rm
Each line in the output of locate is treated as a argument by xargs, so are -L1
and -n 1
the same?
Thanks.
xargs
From Search for and remove files safely
locate -i nohup.out | xargs -d '\n' -L1 -p rm
Each line in the output of locate is treated as a argument by xargs, so are -L1
and -n 1
the same?
Thanks.
Best Answer
From the manual:
Based on this and my understanding, in your case
-L1
and-n1
are made equivalent both by the argument1
passed and the delimiter changed from blank space to\n
(newline) by the argument-d
For example, without the
-d
argument if you were to have a blank space in your locate output, then this line would be splitted into two arguments and hence 2 different use of rm with-n1
, while it would still be treated as one argument and only one command with-L1