github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/f.md (about)

     1  # `f`
     2  
     3  > Lists or filters file system objects (eg files)
     4  
     5  ## Description
     6  
     7  `f` lists or filters lists of file system objects, such as files, directories,
     8  etc. `f` provides a quick way to output file system items that confirm to
     9  specific criteria.
    10  
    11  You define this criteria by using +flags (eg `+s` for all symlinks) and
    12  optionally then restricting that criteria with -flags (eg `-x` to remove all
    13  executable items). All flags supported as `+` are also supported as a `-`.
    14  
    15  By default `f` will return no results. You need to include +flags.
    16  
    17  Output is a JSON array as this format preserves whitespace in file names.
    18  
    19  ## Usage
    20  
    21  ```
    22  f options -> <stdout>
    23  
    24  <stdin> -> f options -> <stdout>
    25  ```
    26  
    27  ## Examples
    28  
    29  Return only directories:
    30  
    31  ```
    32  f +d
    33  ```
    34  
    35  Return file and directories but exclude symlinks:
    36  
    37  ```
    38  f +fd -s
    39  ```
    40  
    41  Filter out files in a list (eg created by `g`) using conditions set by `f`:
    42  
    43  ```
    44  g '*.go' -> f +f
    45  
    46  rx '\.(txt|md)' -> f +fw
    47  ```
    48  
    49  ## Flags
    50  
    51  * `+`
    52      include files (pair this with any other flag apart from `-`)
    53  * `-`
    54      exclude files (pair this with any other flag apart from `+`)
    55  * `?`
    56      deprecated -- use `i` instead
    57  * `D`
    58      regular directories
    59  * `E`
    60      other read permissions
    61  * `F`
    62      regular files (exc symlinks, devices, sockets, named pipes, etc)
    63  * `Q`
    64      other write permissions
    65  * `R`
    66      user read permissions
    67  * `S`
    68      sockets
    69  * `W`
    70      user write permissions
    71  * `X`
    72      user execute permissions
    73  * `Z`
    74      other execute permissions
    75  * `b`
    76      block devices
    77  * `c`
    78      character devices
    79  * `d`
    80      all directories (inc symlinks)
    81  * `e`
    82      group read permissions
    83  * `f`
    84      all files (inc symlinks, devices, sockets, name pipes, etc)
    85  * `i`
    86      irregular files (nothing else is known about these files)
    87  * `l`
    88      symlinks
    89  * `p`
    90      POSIX named pipes (FIFO)
    91  * `q`
    92      group write permissions
    93  * `r`
    94      read permissions (user, group, or other)
    95  * `s`
    96      symlinks
    97  * `w`
    98      write permissions (user, group, or other)
    99  * `x`
   100      execute permissions (user, group, or other)
   101  * `z`
   102      group execute permissions
   103  
   104  ## Detail
   105  
   106  `+` flags are always matched first. Then the `-` flags are used to filter out
   107  any matches from the `+` flags.
   108  
   109  ## See Also
   110  
   111  * [`g`](../commands/g.md):
   112    Glob pattern matching for file system objects (eg `*.txt`)
   113  * [`json`](../types/json.md):
   114    JavaScript Object Notation (JSON)
   115  * [`rx`](../commands/rx.md):
   116    Regexp pattern matching for file system objects (eg `.*\\.txt`)
   117  
   118  <hr/>
   119  
   120  This document was generated from [builtins/core/io/f_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/io/f_doc.yaml).