What's new

Find command missing tons of actions.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

unsynaps

Senior Member
Is there any reason the 'find' command on the routers are missing tons of actions compared to the BusyBox documentation? Specifically -type and -maxdepth?

This:
Code:
BusyBox v1.24.1 (2018-03-10 13:31:44 EST) multi-call binary.

Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]

Search for files and perform actions on them.
First failed action stops processing of current file.
Defaults: PATH is current directory, action is '-print'

        -L,-follow      Follow symlinks
        -H              ...on command line only

Actions:
        ! ACT           Invert ACT's success/failure
        ACT1 [-a] ACT2  If ACT1 fails, stop, else do ACT2
        ACT1 -o ACT2    If ACT1 succeeds, stop, else do ACT2
                        Note: -a has higher priority than -o
        -name PATTERN   Match file name (w/o directory name) to PATTERN
        -iname PATTERN  Case insensitive -name
        -mtime DAYS     mtime is greater than (+N), less than (-N),
                        or exactly N days in the past
If none of the following actions is specified, -print is assumed
        -print          Print file name
        -print0         Print file name, NUL terminated
        -exec CMD ARG ; Run CMD with all instances of {} replaced by
                        file name. Fails if CMD exits with nonzero

VS This:
Code:
find [PATH]... [EXPRESSION]

Search for files. The default PATH is the current directory, default EXPRESSION is '-print'

EXPRESSION may consist of:

        -follow         Follow symlinks
        -xdev           Don't descend directories on other filesystems
        -maxdepth N     Descend at most N levels. -maxdepth 0 applies
                        tests/actions to command line arguments only
        -mindepth N     Don't act on first N levels
        -name PATTERN   File name (w/o directory name) matches PATTERN
        -iname PATTERN  Case insensitive -name
        -path PATTERN   Path matches PATTERN
        -regex PATTERN  Path matches regex PATTERN
        -type X         File type is X (X is one of: f,d,l,b,c,...)
        -perm NNN       Permissions match any of (+NNN), all of (-NNN),
                        or exactly NNN
        -mtime DAYS     Modified time is greater than (+N), less than (-N),
                        or exactly N days
        -mmin MINS      Modified time is greater than (+N), less than (-N),
                        or exactly N minutes
        -newer FILE     Modified time is more recent than FILE's
        -inum N         File has inode number N
        -user NAME      File is owned by user NAME (numeric user ID allowed)
        -group NAME     File belongs to group NAME (numeric group ID allowed)
        -depth          Process directory name after traversing it
        -size N[bck]    File size is N (c:bytes,k:kbytes,b:512 bytes(def.))
                        +/-N: file size is bigger/smaller than N
        -links N        Number of links is greater than (+N), less than (-N),
                        or exactly N
        -print          Print (default and assumed)
        -print0         Delimit output with null characters rather than
                        newlines
        -exec CMD ARG ; Run CMD with all instances of {} replaced by the
                        matching files
        -prune          Stop traversing current subtree
        -delete         Delete files, turns on -depth option
        (EXPR)          Group an expression
 
Is there any reason the 'find' command on the routers are missing tons of actions compared to the BusyBox documentation? Specifically -type and -maxdepth?

This:
Code:
BusyBox v1.24.1 (2018-03-10 13:31:44 EST) multi-call binary.

Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]

Search for files and perform actions on them.
First failed action stops processing of current file.
Defaults: PATH is current directory, action is '-print'

        -L,-follow      Follow symlinks
        -H              ...on command line only

Actions:
        ! ACT           Invert ACT's success/failure
        ACT1 [-a] ACT2  If ACT1 fails, stop, else do ACT2
        ACT1 -o ACT2    If ACT1 succeeds, stop, else do ACT2
                        Note: -a has higher priority than -o
        -name PATTERN   Match file name (w/o directory name) to PATTERN
        -iname PATTERN  Case insensitive -name
        -mtime DAYS     mtime is greater than (+N), less than (-N),
                        or exactly N days in the past
If none of the following actions is specified, -print is assumed
        -print          Print file name
        -print0         Print file name, NUL terminated
        -exec CMD ARG ; Run CMD with all instances of {} replaced by
                        file name. Fails if CMD exits with nonzero

VS This:
Code:
find [PATH]... [EXPRESSION]

Search for files. The default PATH is the current directory, default EXPRESSION is '-print'

EXPRESSION may consist of:

        -follow         Follow symlinks
        -xdev           Don't descend directories on other filesystems
        -maxdepth N     Descend at most N levels. -maxdepth 0 applies
                        tests/actions to command line arguments only
        -mindepth N     Don't act on first N levels
        -name PATTERN   File name (w/o directory name) matches PATTERN
        -iname PATTERN  Case insensitive -name
        -path PATTERN   Path matches PATTERN
        -regex PATTERN  Path matches regex PATTERN
        -type X         File type is X (X is one of: f,d,l,b,c,...)
        -perm NNN       Permissions match any of (+NNN), all of (-NNN),
                        or exactly NNN
        -mtime DAYS     Modified time is greater than (+N), less than (-N),
                        or exactly N days
        -mmin MINS      Modified time is greater than (+N), less than (-N),
                        or exactly N minutes
        -newer FILE     Modified time is more recent than FILE's
        -inum N         File has inode number N
        -user NAME      File is owned by user NAME (numeric user ID allowed)
        -group NAME     File belongs to group NAME (numeric group ID allowed)
        -depth          Process directory name after traversing it
        -size N[bck]    File size is N (c:bytes,k:kbytes,b:512 bytes(def.))
                        +/-N: file size is bigger/smaller than N
        -links N        Number of links is greater than (+N), less than (-N),
                        or exactly N
        -print          Print (default and assumed)
        -print0         Delimit output with null characters rather than
                        newlines
        -exec CMD ARG ; Run CMD with all instances of {} replaced by the
                        matching files
        -prune          Stop traversing current subtree
        -delete         Delete files, turns on -depth option
        (EXPR)          Group an expression
Don't know but I'm curious which FW you are running. I'm on the latest official (384.20308) and I have BusyBox v1.17.4 (2018-01-31 17:28:03 CST). It has even different options:
BusyBox v1.17.4 (2018-01-31 17:28:03 CST) multi-call binary.
Usage: find [PATH]... [EXPRESSION]
Search for files. The default PATH is the current directory,
default EXPRESSION is '-print'
EXPRESSION may consist of:
-follow Follow symlinks
-mindepth N Don't act on first N levels
-name PATTERN File name (w/o directory name) matches PATTERN
-iname PATTERN Case insensitive -name
-mtime DAYS Modified time is greater than (+N), less than (-N),
or exactly N days
-print Print (default and assumed)
-print0 Delimit output with null characters rather than
newlines
-exec CMD ARG ; Run CMD with all instances of {} replaced by the
matching files​

I guess it is up to the dev team to decide how much to include in the build.
 
Last edited:
Which models and which firmware versions are you comparing?
 
RT-AC68P running ASUS WRT Official build 384.20308 = BusyBox v1.17.4

I was referring to the original poster. I should normally have the same BB options on all models that I support, however these will be different from the stock firmware.
 
He was comparing his router's output (using your 384 firmware I believe) to the Command Help that is posted on the busybox website.

Busybox is highly configurable, and not all options are enabled, for performance reasons (i.e. every time you run any Busybox command, you end up loading and running the whole busybox executable, with all of its memory usage).
 
Is there any reason the 'find' command on the routers are missing tons of actions compared to the BusyBox documentation? Specifically -type and -maxdepth?
I think that Entware is your friend for this topic:
findutils - 4.6.0-1 - Replace busybox versions of findutils with full GNU versions. This is normally not needed as busybox is smaller and provides sufficient functionality, but some users may want or need the full functionality of the GNU tools.

chief@RT-AC87U:/tmp/mnt/ac87u# /opt/bin/find --help
Usage: /opt/bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:
operators (decreasing precedence; -and is implicit where no others are given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
positional options (always true): -daystart -follow -regextype
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
-context CONTEXT
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
-exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
-execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.

chief@RT-AC87U:/tmp/mnt/ac87u# /opt/bin/find --version
find (GNU findutils) 4.6.0
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
 
Similar threads
Thread starter Title Forum Replies Date
M VPN menu missing on Asus AX11000 ASUS Wireless 3

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Top