Differences between revisions 3 and 4
Revision 3 as of 2023-08-21 02:24:28
Size: 1174
Comment:
Revision 4 as of 2024-09-16 13:49:00
Size: 1256
Comment: Link
Deletions are marked like this. Additions are marked like this.
Line 71: Line 71:
----



== See also ==

[[https://man.archlinux.org/man/find.1|find(1)]]

Find

find(1) is a file finder.


Installation

find(1) will be pre-installed on any Linux or BSD operating system, as a POSIX utility.


Usage

find(1) identifies files and, by default, simply prints them.

find(1) can alternatively execute a command on the file name. Note that this occurs in a subshell, so functions and environment variables are not accessible to the command.

find . --exec mv ../backup/{} \;

File Name

To find all files with a name matching a pattern, try:

find . -name '*.pyc' -exec rm {} \;

File Ownership

To find all files owned by user foo, try:

find . -user foo -exec chown bar {} \;

To find all files in the group foo, try:

find . -group foo -exec chgrp bar {} \;

File Permissions

To find all files with some permission level, try:

find . -type d -perm 755

Conversely, to find all files with any other permission level, try:

find . -type f -not -perm 644 -exec chmod 644 {} \;


See also

find(1)


CategoryRicottone

Find (last edited 2024-12-28 15:42:20 by DominicRicottone)