github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/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 working 14 directory] on a Nomad client. The following functionalities are available - 15 `cat`, `tail`, `ls` and `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 36 path. The path is optional and relative to the root of the [allocation working 37 directory]. 38 39 When ACLs are enabled, this command requires a token with the `read-fs`, 40 `read-job`, and `list-jobs` capabilities for the allocation's namespace. 41 42 ## General Options 43 44 @include 'general_options.mdx' 45 46 ## Fs Options 47 48 - `-H`: Machine friendly output. 49 50 - `-verbose`: Display verbose output. 51 52 - `-job`: Use a random allocation from the specified job, preferring a running 53 allocation. 54 55 - `-stat`: Show stat information instead of displaying the file, or listing the 56 directory. 57 58 - `-f`: Causes the output to not stop when the end of the file is reached, but 59 rather to wait for additional output. 60 61 - `-tail`: Show the files contents with offsets relative to the end of the file. 62 If no offset is given, -n is defaulted to 10. 63 64 - `-n`: Sets the tail location in best-efforted number of lines relative to the 65 end of the file. 66 67 - `-c`: Sets the tail location in number of bytes relative to the end of the file. 68 69 ## Examples 70 71 ```shell-session 72 $ nomad alloc fs eb17e557 73 Mode Size Modified Time Name 74 drwxrwxr-x 4096 28 Jan 16 05:39 UTC alloc/ 75 drwxrwxr-x 4096 28 Jan 16 05:39 UTC redis/ 76 -rw-rw-r-- 0 28 Jan 16 05:39 UTC redis_exit_status 77 78 79 $ nomad alloc fs eb17e557 redis/local 80 Mode Size Modified Time Name 81 -rw-rw-rw- 0 28 Jan 16 05:39 UTC redis.stderr 82 -rw-rw-rw- 17 28 Jan 16 05:39 UTC redis.stdout 83 84 85 $ nomad alloc fs -stat eb17e557 redis/local/redis.stdout 86 Mode Size Modified Time Name 87 -rw-rw-rw- 17 28 Jan 16 05:39 UTC redis.stdout 88 89 90 $ nomad alloc fs eb17e557 redis/local/redis.stdout 91 foobar 92 baz 93 94 $ nomad alloc fs -tail -f -n 3 eb17e557 redis/local/redis.stdout 95 foobar 96 baz 97 bam 98 <blocking> 99 ``` 100 101 ## Using Job ID instead of Allocation ID 102 103 Setting the `-job` flag causes a random allocation of the specified job to be 104 selected. Nomad will prefer to select a running allocation ID for the job, but 105 if no running allocations for the job are found, Nomad will use a dead 106 allocation. 107 108 ```plaintext 109 nomad alloc fs -job <job-id> <path> 110 ``` 111 112 This can be useful for debugging a job that has multiple allocations, and it is 113 not required to observe a specific allocation. 114 115 [allocation working directory]: /docs/runtime/environment#task-directories 'Task Directories'