> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ls - List files in the image

List files and directories in the session image without spawning a sandbox.

## Examples

```bash theme={null}
# List root directory
contree ls /

# List a specific directory
contree ls /etc/nginx

# JSON output with file metadata
contree -f json ls /usr/bin
```

## Help output

<div className="contree-terminal" style={{"border":"1px solid rgba(255,255,255,0.15)","borderRadius":8,"overflow":"hidden","margin":"1rem 0"}}><div style={{"background":"#292929","height":24,"display":"flex","alignItems":"center","padding":"0 12px","position":"relative"}}><div style={{"display":"flex","alignItems":"center","flexShrink":0}}><span style={{"display":"inline-block","width":10,"height":10,"borderRadius":"50%","background":"#ff5f57","marginRight":6}} /><span style={{"display":"inline-block","width":10,"height":10,"borderRadius":"50%","background":"#febc2e","marginRight":6}} /><span style={{"display":"inline-block","width":10,"height":10,"borderRadius":"50%","background":"#28c840"}} /></div><div style={{"position":"absolute","left":0,"right":0,"textAlign":"center","fontFamily":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif","fontWeight":"bold","color":"#999"}}>\$ contree ls --help</div></div><pre style={{"margin":0,"borderRadius":0,"padding":"8px 10px","background":"#1e1e1e","overflowX":"auto"}}><code style={{"fontFamily":"JetBrains Mono, SF Mono, SFMono-Regular, Menlo, Monaco, Cascadia Mono, Segoe UI Mono, Roboto Mono, Oxygen Mono, Ubuntu Monospace, Source Code Pro, Fira Mono, Droid Sans Mono, Consolas, Courier New, monospace","color":"#c5c8c6","whiteSpace":"pre-wrap"}}><span style={{"color":"#61afef","fontWeight":"bold"}}>usage: </span><span style={{"color":"#c678dd","fontWeight":"bold"}}>contree ls</span><span style={{"color":"#c5c8c6"}}> \[</span><span style={{"color":"#98c379"}}>-h</span><span style={{"color":"#c5c8c6"}}>] </span><span style={{"color":"#98c379"}}>\[path]</span><br /><br /><span style={{"color":"#c5c8c6"}}>List files in the session image.</span><br /><br /><span style={{"color":"#c5c8c6"}}>Uses the /inspect/ API to list directory contents without spawning an</span><br /><span style={{"color":"#c5c8c6"}}>instance. Defaults to the session working directory (set via \`cd\`).</span><br /><br /><span style={{"color":"#c5c8c6"}}>In default format, the API returns a pre-formatted text listing. In</span><br /><span style={{"color":"#c5c8c6"}}>structured formats (json, csv, etc.) the response is cached per</span><br /><span style={{"color":"#c5c8c6"}}>(image, path) for instant repeat queries.</span><br /><br /><span style={{"color":"#61afef","fontWeight":"bold"}}>positional arguments:</span><br /><span style={{"color":"#c5c8c6"}}>  </span><span style={{"color":"#98c379","fontWeight":"bold"}}>path</span><span style={{"color":"#c5c8c6"}}>        Path inside image (defaults to session cwd)</span><br /><br /><span style={{"color":"#61afef","fontWeight":"bold"}}>options:</span><br /><span style={{"color":"#c5c8c6"}}>  </span><span style={{"color":"#98c379","fontWeight":"bold"}}>-h</span><span style={{"color":"#c5c8c6"}}>, </span><span style={{"color":"#56b6c2","fontWeight":"bold"}}>--help</span><span style={{"color":"#c5c8c6"}}>  show this help message and exit</span><br /><br /><span style={{"color":"#c5c8c6"}}>for coding agents:</span><br /><span style={{"color":"#c5c8c6"}}>  read-only command (inspect API, no instance spawn)</span><br /><span style={{"color":"#c5c8c6"}}>  defaults to session cwd when PATH is omitted</span><br /><span style={{"color":"#c5c8c6"}}>  use -f json for cacheable structured listings</span><br /><br /><span style={{"color":"#c5c8c6"}}>agent note:</span><br /><span style={{"color":"#c5c8c6"}}>  Before using this command in an automated workflow, read:</span><br /><span style={{"color":"#c5c8c6"}}>    contree agent</span></code></pre></div>

## Output

Each entry shows path, size, permissions (octal), owner, group, modification
time, and type (`d` for directory, `l` for symlink, `-` for file).

This command reads the image filesystem directly – no sandbox is started and
no resources are consumed.

## See also

* [cat - Show file content from the image](./cat) – view file contents
* [cp - Download a file from the image](./cp) – download a file locally
* [Your First Sandbox](../tutorial/first-steps) – inspecting the filesystem
