This is very useful when performing the same action on multiple files in different locations.
The above command is an example of listing the permissions and other metadata of every file that the find command finds.
The above command is an example of listing the permissions and other metadata of every file that the find command finds.
A breakdown of the -exec option:
• exec ls - this tells find to execute the ls command on every filename that matches the search string.
• -lah - displays all files, including hidden files, their permissions, and other file metadata, such as sizes, in human readable format.
• exec ls - this tells find to execute the ls command on every filename that matches the search string.
• -lah - displays all files, including hidden files, their permissions, and other file metadata, such as sizes, in human readable format.
• {} - The “{}” placeholder represents each filename and must be the last item in the parameter list.
• ; - To indicate the end of the parameter list, a semicolon ";" is used. It must be escaped with a backslash "\" otherwise the shell will interpret it.
• ; - To indicate the end of the parameter list, a semicolon ";" is used. It must be escaped with a backslash "\" otherwise the shell will interpret it.
You can also use the + instead of the ; to indicate the end of the parameter list. There should be a space between the + and the curly braces "{}".
Follow us (@linuxopsys) for more byte sized Linux tips and be a better informed Linux user 🐧😎
Follow us (@linuxopsys) for more byte sized Linux tips and be a better informed Linux user 🐧😎
Loading suggestions...