linux의 fd 명령어는 find명령어를 대체할 수 있는 사용자 친화적인 CLI 입니다.

기본 사용법

$> fd
test/1.txt
...

TLDR

$> tldr fd

  fd

  An alternative to find.
  Aims to be faster and easier to use than find.
  More information: https://github.com/sharkdp/fd.

  - Find files matching the given pattern in the current directory:
    fd pattern

  - Find files that begin with "foo":
    fd '^foo'

  - Find files with a specific extension:
    fd --extension txt

  - Find files in a specific directory:
    fd pattern path/to/dir

  - Include ignored and hidden files in the search:
    fd --hidden --no-ignore pattern


See also: find

Help

$> fd --help
fd 8.1.1

USAGE:
    fd [FLAGS/OPTIONS] [<pattern>] [<path>...]

FLAGS:
    -H, --hidden             
            Include hidden directories and files in the search results (default: hidden files and
            directories are skipped). Files and directories are considered to be hidden if their name
            starts with a `.` sign (dot).
    -I, --no-ignore          
            Show search results from files and directories that would otherwise be ignored by
            '.gitignore', '.ignore', '.fdignore', or the global ignore file.
        --no-ignore-vcs      
            Show search results from files and directories that would otherwise be ignored by
            '.gitignore' files.
    -u, --unrestricted       
            Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for '--no-ignore --hidden'.

    -s, --case-sensitive     
            Perform a case-sensitive search. By default, fd uses case-insensitive searches, unless
            the pattern contains an uppercase character (smart case).
    -i, --ignore-case        
            Perform a case-insensitive search. By default, fd uses case-insensitive searches, unless
            the pattern contains an uppercase character (smart case).
    -g, --glob               
            Perform a glob-based search instead of a regular expression search.

        --regex              
            Perform a regular-expression based search (default). This can be used to override --glob.

    -F, --fixed-strings      
            Treat the pattern as a literal string instead of a regular expression.

    -a, --absolute-path      
            Shows the full path starting from the root as opposed to relative paths.

    -l, --list-details       
            Use a detailed listing format like 'ls -l'. This is basically an alias for '--exec-batch
            ls -l' with some additional 'ls' options. This can be used to see more metadata, to show
            symlink targets and to achieve a deterministic sort order.
    -L, --follow             
            By default, fd does not descend into symlinked directories. Using this flag, symbolic
            links are also traversed.
    -p, --full-path          
            By default, the search pattern is only matched against the filename (or directory name).
            Using this flag, the pattern is matched against the full path.
    -0, --print0             
            Separate search results by the null character (instead of newlines). Useful for piping
            results to 'xargs'.
    -1                       
            Limit the search to a single result and quit immediately. This is an alias for '--max-
            results=1'.
        --show-errors        
            Enable the display of filesystem errors for situations such as insufficient permissions
            or dead symlinks.
        --one-file-system    
            By default, fd will traverse the file system tree as far as other options dictate. With
            this flag, fd ensures that it does not descend into a different file system than the one
            it started in. Comparable to the -mount or -xdev filters of find(1).
    -h, --help               
            Prints help information

    -V, --version            
            Prints version information


OPTIONS:
    -d, --max-depth <depth>               
            Limit the directory traversal to a given depth. By default, there is no limit on the
            search depth.
        --min-depth <depth>               
            Only show search results starting at the given depth. See also: '--max-depth' and
            '--exact-depth'
        --exact-depth <depth>             
            Only show search results at the exact given depth. This is an alias for '--min-depth
            <depth> --max-depth <depth>'.
    -t, --type <filetype>...
            Filter the search by type (multiple allowable filetypes can be specified):
              'f' or 'file':         regular files
              'd' or 'directory':    directories
              'l' or 'symlink':      symbolic links
              'x' or 'executable':   executables
              'e' or 'empty':        empty files or directories
              's' or 'socket':       socket
              'p' or 'pipe':         named pipe (FIFO)
    -e, --extension <ext>...              
            (Additionally) filter search results by their file extension. Multiple allowable file
            extensions can be specified.
    -x, --exec <cmd>                      
            Execute a command for each search result.
            All arguments following --exec are taken to be arguments to the command until the
            argument ';' is encountered.
            Each occurrence of the following placeholders is substituted by a path derived from the
            current search result before the command is executed:
              '{}':   path
              '{/}':  basename
              '{//}': parent directory
              '{.}':  path without file extension
              '{/.}': basename without file extension
    -X, --exec-batch <cmd>                
            Execute a command with all search results at once.
            All arguments following --exec-batch are taken to be arguments to the command until the
            argument ';' is encountered.
            A single occurrence of the following placeholders is authorized and substituted by the
            paths derived from the search results before the command is executed:
              '{}':   path
              '{/}':  basename
              '{//}': parent directory
              '{.}':  path without file extension
              '{/.}': basename without file extension
    -E, --exclude <pattern>...            
            Exclude files/directories that match the given glob pattern. This overrides any other
            ignore logic. Multiple exclude patterns can be specified.
        --ignore-file <path>...           
            Add a custom ignore-file in '.gitignore' format. These files have a low precedence.

    -c, --color <when>                    
            Declare when to use color for the pattern match output:
              'auto':      show colors if the output goes to an interactive console (default)
              'never':     do not use colorized output
              'always':    always use colorized output
    -j, --threads <num>                   
            Set number of threads to use for searching & executing (default: number of available CPU
            cores)
    -S, --size <size>...                  
            Limit results based on the size of files using the format <+-><NUM><UNIT>.
               '+': file size must be greater than or equal to this
               '-': file size must be less than or equal to this
               'NUM':  The numeric size (e.g. 500)
               'UNIT': The units for NUM. They are not case-sensitive.
            Allowed unit values:
                'b':  bytes
                'k':  kilobytes (base ten, 10^3 = 1000 bytes)
                'm':  megabytes
                'g':  gigabytes
                't':  terabytes
                'ki': kibibytes (base two, 2^10 = 1024 bytes)
                'mi': mebibytes
                'gi': gibibytes
                'ti': tebibytes
        --changed-within <date|dur>       
            Filter results based on the file modification time. The argument can be provided as a
            specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min).
            '--change-newer-than' can be used as an alias.
            Examples:
                --changed-within 2weeks
                --change-newer-than '2018-10-27 10:00:00'
        --changed-before <date|dur>       
            Filter results based on the file modification time. The argument can be provided as a
            specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min).
            '--change-older-than' can be used as an alias.
            Examples:
                --changed-before '2018-10-27 10:00:00'
                --change-older-than 2weeks
        --max-results <count>             
            Limit the number of search results to 'count' and quit immediately.

        --base-directory <path>           
            Change the current working directory of fd to the provided path. The means that search
            results will be shown with respect to the given base path. Note that relative paths which
            are passed to fd via the positional <path> argument or the '--search-path' option will
            also be resolved relative to this directory.
        --path-separator <separator>      
            Set the path separator to use when printing file paths. The default is the OS-specific
            separator ('/' on Unix, '\' on Windows).
        --search-path <search-path>...    
            Provide paths to search as an alternative to the positional <path> argument. Changes the
            usage to `fd [FLAGS/OPTIONS] --search-path <path> --search-path <path2> [<pattern>]`
    -o, --owner <user:group>              
            Filter files by their user and/or group. Format: [(user|uid)][:(group|gid)]. Either side
            is optional. Precede either side with a '!' to exclude files instead.
            Examples:
                --owner john
                --owner :students
                --owner '!john:students'

ARGS:
    <pattern>    
            the search pattern - a regular expression unless '--glob' is used (optional)

    <path>...    
            The directory where the filesystem search is rooted (optional). If omitted, search the
            current working directory.

Note: `fd -h` prints a short and concise overview while `fd --help` gives all details.

참고

  • fd{:target=“blank”}