find . -maxdepth 1 -exec stat -c '%a %n' {} +
let’s break down this bash command step by step
find .
: This command starts searching in the current directory (.
).-maxdepth 1
: This option restricts the search to only the current directory, not any subdirectories. So it won’t go deeper than one level down.-exec
: This option executes a specified command for each matched file.stat -c '%a %n' {} +
: This is the command that will be executed for each file found. Here’s what it does:stat
: This command displays file or file system status.-c '%a %n'
: This option specifies the format for the output ofstat
.%a
displays the access permissions in octal (like 755, 644, etc.), and%n
displays the file name.{}
: This is a placeholder for each file found byfind
.+
: This indicates the end of the-exec
command.
So, in simple terms, this bash command finds all files in the current directory (not in subdirectories), then for each file found, it displays the file’s access permissions in octal format followed by its filename.