github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/commands/alloc/fs.mdx (about)

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