github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/website/source/docs/commands/fs.html.md.erb (about)

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