Centos find file12/30/2022 Linux has many methods to achieve the same task. Therefore, if you are dealing with many files, xargs would be convenient over – exec. This makes xargs a little faster than –exec. While xargs executes the command at once for all the matched files. If we use the –exec command to remove the files, it will remove them file by file. Contrary to xargs, – exec executes the command every time a file matches the condition. It can execute commands based on the output of the first command. The previous ls command shows the existing files before executing find, and the second ls shows the result with all the “.txt” files deleted.Īs you can see, the ls ~/dir1/* result was passed by xargs after the mv command. You can see the command in the third line of the following figure. In this case, we will replace the – delete option with the -exec rm again to delete all the “.txt” files as we did in the second example of this document but using a different technique. As you can see, there are different “.txt” files. Now, let’s see a new scenario using the ls command again.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |