github.com/smintz/nomad@v0.8.3/website/source/docs/commands/alloc/fs.html.md.erb (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands: alloc fs"
     4  sidebar_current: "docs-commands-alloc-fs"
     5  description: >
     6    Introspect an allocation directory on a Nomad client
     7  ---
     8  
     9  # Command: alloc fs
    10  **Alias: `nomad fs`**
    11  
    12  The `alloc fs` command allows a user to navigate an allocation directory on a Nomad
    13  client. The following functionalities are available - `cat`, `tail`, `ls` and
    14  `stat`.
    15  
    16  * `cat`: If the target path is a file, Nomad will `cat` the file.
    17  * `tail`: If the target path is a file and `-tail` flag is specified, Nomad will
    18          `tail` the file.
    19  * `ls`: If the target path is a directory, Nomad displays the name of a file and
    20        directories and their associated information.
    21  * `stat`: If the `-stat` flag is used, Nomad will display information about a
    22          file.
    23  
    24  ## Usage
    25  
    26  ```
    27  nomad alloc fs [options] <allocation> <path>
    28  ```
    29  
    30  This command accepts a single allocation ID (unless the `-job` flag is specified,
    31  in which case an allocation is chosen from the given job) and a path. The path is
    32  relative to the root of the allocation directory.  The path is optional and it
    33  defaults to `/` of the allocation directory.
    34  
    35  ## General Options
    36  
    37  <%= partial "docs/commands/_general_options" %>
    38  
    39  ## Fs Options
    40  
    41  * `-H`: Machine friendly output.
    42  
    43  * `-verbose`: Display verbose output.
    44  
    45  * `-job`: Use a random allocation from the specified job, preferring a running
    46  allocation.
    47  
    48  * `-stat`: Show stat information instead of displaying the file, or listing the
    49  directory.
    50  
    51  * `-f`: Causes the output to not stop when the end of the file is reached, but
    52  rather to wait for additional output.
    53  
    54  * `-tail`: Show the files contents with offsets relative to the end of the file.
    55  If no offset is given, -n is defaulted to 10.
    56  
    57  * `-n`: Sets the tail location in best-efforted number of lines relative to the
    58  end of the file.
    59  
    60  * `-c`: Sets the tail location in number of bytes relative to the end of the file.
    61  
    62  ## Examples
    63  
    64  ```
    65  $ nomad alloc fs eb17e557
    66  Mode        Size  Modified Time        Name
    67  drwxrwxr-x  4096  28 Jan 16 05:39 UTC  alloc/
    68  drwxrwxr-x  4096  28 Jan 16 05:39 UTC  redis/
    69  -rw-rw-r--  0     28 Jan 16 05:39 UTC  redis_exit_status
    70  
    71  
    72  $ nomad alloc fs eb17e557 redis/local
    73  Mode        Size  Modified Time        Name
    74  -rw-rw-rw-  0     28 Jan 16 05:39 UTC  redis.stderr
    75  -rw-rw-rw-  17    28 Jan 16 05:39 UTC  redis.stdout
    76  
    77  
    78  $ nomad alloc fs -stat eb17e557 redis/local/redis.stdout
    79  Mode        Size  Modified Time        Name
    80  -rw-rw-rw-  17    28 Jan 16 05:39 UTC  redis.stdout
    81  
    82  
    83  $ nomad alloc fs eb17e557 redis/local/redis.stdout
    84  foobar
    85  baz
    86  
    87  $ nomad alloc fs -tail -f -n 3 eb17e557 redis/local/redis.stdout
    88  foobar
    89  baz
    90  bam
    91  <blocking>
    92  ```
    93  
    94  ## Using Job ID instead of Allocation ID
    95  
    96  Setting the `-job` flag causes a random allocation of the specified job to be
    97  selected. Nomad will prefer to select a running allocation ID for the job, but
    98  if no running allocations for the job are found, Nomad will use a dead
    99  allocation.
   100  
   101  ```
   102  nomad alloc fs -job <job-id> <path>
   103  ```
   104  
   105  
   106  This can be useful for debugging a job that has multiple allocations, and it's
   107  not really required to use a specific allocation ID.