FIND2PERL(1)

πŸ“¦
version 1.005 Β· 3 versions
, in fedora 43

πŸ’– FIND2PERL β€” the manual page, but make it cute πŸ’–

okay bestie, gather round, because we're talking about find2perl from the User Contributed Perl Documentation section (that's section 1, the user commands one, iykyk) πŸ’…


✨ NAME ✨

find2perl β€” the girl who translates your find command lines into straight-up Perl code πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

find2perl [paths] [predicates] | perl

πŸ¦‹ DESCRIPTION πŸ¦‹

so find2perl is literally just a tiny little translator, no cap πŸ’– It takes find command lines and turns them into equivalent Perl code. And the tea? The code it spits out is typically faster than running find itself. periodt. πŸƒβ™€οΈπŸ’¨

paths are a set of paths where find2perl will start its searches, and predicates are taken from the following list πŸ‘‡

  • ! PREDICATE β€” negates the vibe of the predicate that comes next. The ! must be passed as a distinct argument, so you may need to surround it with whitespace and/or quote it from interpretation by the shell using a backslash (just as with using find(1)). πŸ™ˆ
  • ( PREDICATES ) β€” groups the given PREDICATES together, like a little friendship circle 🫢 The parentheses must be passed as distinct arguments, so they may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)).
  • PREDICATE1 PREDICATE2 β€” true if both PREDICATE1 and PREDICATE2 are true; PREDICATE2 is not evaluated if PREDICATE1 is false. it's giving "if you can't come through on the first one, don't even bother with the second" πŸ’€
  • PREDICATE1 -o PREDICATE2 β€” true if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2 is not evaluated if PREDICATE1 is true. main character gets there first, second one doesn't even get screen time πŸ‘‘
  • -follow β€” follow (dereference) symlinks. 🧚 The checking of file attributes depends on the position of the -follow option. If it precedes the file check option, an stat is done, which means the file check applies to the file the symbolic link is pointing to. If -follow follows the file check option, this now applies to the symbolic link itself, i.e. an lstat is done. order matters bestie, don't play with it ⚠️
  • -depth β€” change directory traversal algorithm from breadth-first to depth-first. 🌊 going deep instead of going wide, we love a vibe shift
  • -prune β€” do not descend into the directory currently matched. it said "not today", and it meant it βœ‹
  • -xdev β€” do not traverse mount points (prunes search at mount-point directories). staying in your own lane fr fr 🚧
  • -name GLOB β€” file name matches the specified GLOB wildcard pattern. GLOB may need to be quoted to avoid interpretation by the shell (just as with using find(1)). 🌸
  • -iname GLOB β€” like -name, but the match is case insensitive. lowercase, uppercase, idc, we're matching either way πŸ’…
  • -path GLOB β€” path name matches the specified GLOB wildcard pattern. πŸ›€οΈ
  • -ipath GLOB β€” like -path, but the match is case insensitive. πŸ¦‹
  • -perm PERM β€” low-order 9 bits of permission match octal value PERM. πŸ”
  • -perm -PERM β€” the bits specified in PERM are all set in the file's permissions. every single one, no exceptions, we're thorough πŸ’–
  • -type X β€” the file's type matches perl's -X operator. 🎯
  • -fstype TYPE β€” filesystem of current path is of type TYPE (only NFS/non-NFS distinction is implemented). that's the whole menu, bestie, just those two πŸ“
  • -user USER β€” true if USER is the owner of the file. πŸ‘€
  • -group GROUP β€” true if the file's group is GROUP. πŸ‘₯
  • -nouser β€” true if the file's owner is not in the password database. ghost owner energy πŸ‘»
  • -nogroup β€” true if the file's group is not in the group database. πŸ‘»
  • -inum INUM β€” true if the file's inode number is INUM. πŸ”’
  • -links N β€” true if the (hard) link count of the file matches N (see below). πŸ”—
  • -size N β€” true if the file's size matches N (see below). N is normally counted in 512-byte blocks, but a suffix of c specifies that size should be counted in characters (bytes) and a suffix of k specifies that size should be counted in 1024-byte blocks. πŸ“
  • -atime N β€” true if the last-access time of the file matches N (measured in days) (see below). ⏰
  • -ctime N β€” true if the last-changed time of the file's inode matches N (measured in days, see below). πŸ•°οΈ
  • -mtime N β€” true if the last-modified time of the file matches N (measured in days, see below). πŸ“†
  • -newer FILE β€” true if the last-modified time of the file matches N. πŸ†•
  • -print β€” print out the path of the file (always true). πŸ’¬ If none of -exec, -ls, -print0, or -ok is specified, then -print will be added implicitly. it's the default bestie, it just shows up 🫢
  • -print0 β€” like -print, but terminates with \0 instead of \n. null-terminated, because newlines in filenames are a menace 😭
  • -exec OPTIONS ; β€” exec() the arguments in OPTIONS in a subprocess; any occurrence of {} in OPTIONS will first be substituted with the path of the current file. Note that the command rm has been special-cased to use perl's unlink() function instead (as an optimization). The ; must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)). πŸƒβ™€οΈ
  • -ok OPTIONS ; β€” like -exec, but first prompts the user; if the user's response does not begin with a y, skip the exec. consent first, always 🫢 The ; must be passed as a distinct argument, so it may need to be surrounded by whitespace and/or quoted from interpretation by the shell using a backslash (just as with using find(1)).
  • -eval EXPR β€” has the perl script eval() the EXPR. πŸͺ„
  • -ls β€” simulates -exec ls -dils {} ;. πŸ“‹
  • -tar FILE β€” adds current output to tar-format FILE. πŸ“¦
  • -cpio FILE β€” adds current output to old-style cpio-format FILE. πŸ—ƒοΈ
  • -ncpio FILE β€” adds current output to "new"-style cpio-format FILE. πŸ—‚οΈ

πŸ”’ the N forms, because numbers have three moods πŸ”’

Predicates which take a numeric argument N can come in three forms:

  • N is prefixed with a +: match values greater than N πŸ“ˆ
  • N is prefixed with a -: match values less than N πŸ“‰
  • N is not prefixed with either + or -: match only values equal to N 🎯

🌈 SEE ALSO 🌈

find, File::Find. go read those too, they're iconic πŸ’œ


and that's the whole page bestie!! this was documented for perl v5.42.0, dated 2025-07-25, and honestly? slay. πŸ’…βœ¨ stay hydrated, quote your globs, and never let the shell eat your semicolons πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from