---
title: Command line (total5)
project: Total.js V5
version: 0.0.20
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/total-js-v5/0-0-20/reference/command-line/
updated: 2026-11-18T16:57:34.578Z
---

# Command line (total5)

> Every command and argument of the total5 and flow5 programs.

The commands of the two programs that the `total5` package installs: `total5`, which works on the current directory, and `flow5`, which runs FlowStream schemas. Each entry shows the syntax, the arguments and an example. For an introduction read [Command line (total5)](../../guides/command-line/).

```bash
npm install -g total5
total5 help
flow5
```

## API

### total5 [command] [arguments]

Type: `command`

The command-line toolbox of the total5 package.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `command` | `String` | no | `help` | The name of the command. |
| `arguments` | `String` | no |  | The arguments of the command, in order. |

Runs one command on the current directory. Without a command it shows the help. Each command prints `* Total.js v5: [Command]` first; the short ones end with a `[Done]` line with the time they took. A command the program does not know prints only that header.

Example: Show the help
```bash
total5
```

### total5 help

Type: `command`

Prints the list of commands.

Prints one line for each command with its arguments and what it does: `translate`, `minify`, `bundle`, `extract`, `edit`, `proxy`, `test` and the web server (`8000`). `total5` with no command does the same.

Example: Help
```bash
total5 help
total5 --help
```

### total5 --<command> [arguments]

Type: `command`

Dashes in front of a command are ignored.

The program removes every run of two or more dashes from the command, so `--help` is `help` and `--minify` is `minify`. Use the form you prefer.

Example: The same command twice
```bash
total5 --help
total5 help
```

### total5 minify <filename>

Type: `command`

Minifies a JavaScript, CSS or HTML file.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `filename` | `String` | yes |  | The full path of the file to minify. |

Reads the file, minifies it by its extension and writes the result next to it as `name.min.ext`. JavaScript and CSS are fully minified. The HTML minifier removes comments, shortens runs of spaces inside the markup and minifies inline `<script>` and `<style>` blocks; it keeps the line breaks and the indentation between tags. A file with another extension is copied without change. It prints the input and the output file names. Give the full path of the file.

Example: Minify a script
```bash
total5 minify "$PWD/public/js/app.js"
# Output    : /home/me/shop/public/js/app.min.js
```

### total5 edit <url>

Type: `command`

Opens the current directory for remote editing in the Total.js Code Editor.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `url` | `String` | yes |  | The address of the project in the Code Editor, for example `https://code.example.com/?id=project`. |

Connects to the URL of the project with a WebSocket (`http` and `https` become `ws` and `wss`) and serves the requests of the editor on the current directory (see Code Editor requests). When the editor accepts the connection it prints a welcome with the name of the editor and of the project. The connection reconnects every 10 seconds and is pinged every 30 seconds. `404 project not found` and `409 project is already open` are printed when the editor refuses the project. Without a URL the program throws `Invalid URL address`.

Example: Edit a project
```bash
cd ~/projects/shop
total5 edit "https://code.example.com/?id=shop"
```

### TYPE: browse | load | save | ...

Type: `type`

What the Code Editor can do through total5 edit.

The editor sends requests and the program answers them inside the current directory: `browse` (the list of files and folders), `load`, `save`, `create`, `remove`, `rename`, `modify`, `info`, `upload`, `download`, `send`, `import`, `log` and `logclear` (log files), `wiki`, `ip` (the public IP address), `exec` (runs a file: `.js` files with Node.js, `.sh` files with `sh`, or a command the editor sends), `restart` and `ping`. An unknown request is answered with an error 400.

Example: A request and its answer
```js
// sent by the editor
{ TYPE: 'browse', data: '{}' }
// answer
{ TYPE: 'browse', data: '{}', success: true, response: { files: ['/index.js'], directories: ['/controllers/'] } }
```

### total5 <port>

Type: `command`

Starts a static web server for the current directory on the given port.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `port` | `Number` | yes |  | The port of the server. |

A number as the command starts the web server: `total5 8000` is `total5 server 8000`. The current directory is the public folder, minification and source maps are off, and the application folders are not loaded. A directory URL shows a listing of the directory. The program prints the start information of the framework and runs until you stop it.

Example: Serve a folder
```bash
cd ~/projects/landing
total5 8000
# open http://127.0.0.1:8000/
```

### total5 proxy <endpoint> <port>

Type: `command` · Since: `0.0.17`

Connects a local port to a remote Total.js proxy server.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `endpoint` | `String` | yes |  | The WebSocket address of the proxy server. |
| `port` | `String` | yes |  | A local port (on `127.0.0.1`) or an `ip:port` pair. |

Opens a WebSocket to the proxy server, an application that calls `PROXYSERVER()` (`http` and `https` are replaced with `ws` and `wss`), and forwards every request that arrives through it to the local address. The answer goes back the same way. The program prints a line when it connects or disconnects and one line for each request with its method, the IP address of the visitor and the URL. Without both arguments it prints `client [WSS proxy server] [port or ip:port]`. It is the same client as the `PROXYCLIENT()` function.

Example: Share a local server
```bash
total5 proxy wss://proxy.example.com/ 8000
```

Example: The server side
```js
// index.js of the proxy server
require('total5');
PROXYSERVER('/', '/proxy/');
F.http({ port: 8000, load: 'none' });

// on your machine:
// total5 proxy wss://proxy.example.com/proxy/ 8000
```

### total5 server [port]

Type: `command`

Starts a static web server for the current directory.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `port` | `Number` | no | `8000` | The port of the server. |

The long form of `total5 <port>`. Without a port it listens on `8000`.

Example: Default port
```bash
total5 server
# http://0.0.0.0:8000/
```

Example: Another port
```bash
total5 server 8080
```

### total5 test [name1] [name2] [...]

Type: `command`

Runs the unit tests of the current directory.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | The name of a test script without `.js`; several names with spaces or commas. |

Takes the `tests` directory of the current directory, or the current directory when there is no `tests` directory. It loads the `config` file of that directory with `LOADCONFIG()`, creates the global `Test`, loads `init.js` when it exists and then the named scripts in their order, or every `.js` file except `init.js` in alphabetical order when no name is given. Then it calls `Test.run()`. Names can be separated with spaces or commas and the `.js` extension is optional. A missing script prints `ERROR: the test "name" not found (path)` and ends with exit code 1. The exit code is 0 when all groups are done and 1 when a check fails or the run stops before the end. The command uses the `total5` package installed in the current directory or in a parent directory (so it also runs from `tests`), otherwise its own package. The application itself is not started and the current directory is the root (`PATH.root()`). See [Unit tests](../../guides/unit-tests/).

Example: All tests
```bash
cd ~/projects/shop
total5 test
```

Example: Two scripts
```bash
total5 test strings orders
total5 test strings,orders
```

### flow5

Type: `command`

Prints the help of the Flow engine.

Without arguments `flow5` prints `[Total.js v5 Flow Engine]` and the ways to call it.

Example: Help
```bash
flow5
# flow5 [path or URL address] [PORT_NUMBER]
# flow5 path/to/flowschema.json
# flow5 flow1.json flow2.json flowN.json 8001
# flow5 https://yourdomain.com/flowschema.json
```

### GET /{path}/

Type: `type`

What the web server shows for a directory.

For a directory URL the server shows an HTML page with a `..` link to the parent (except at `/`), the subdirectories and the files with their sizes. Every link opens the item on the same server; open `index.html` from the listing like any other file.

Example: Browse
```bash
total5 8000
# http://127.0.0.1:8000/            -> the listing of the directory
# http://127.0.0.1:8000/index.html  -> the page
```

### total5 translate <filename>

Type: `command`

Collects the @(...) texts of the current directory into a resource file.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `filename` | `String` | yes |  | The full path of the resource file to write. |

Reads every `.js` and `.html` file of the current directory and of all its subdirectories, finds the texts written as `@(text)` (nested parentheses are kept) and writes them into the resource file, one `KEY : text` line for each text. The same text gives one line. An existing file is overwritten. Give the full path of the file.

Example: Into resources
```bash
total5 translate "$PWD/resources/default.resource"
```

### flow5 <file> [port]

Type: `command`

Runs the flows of a local schema file.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `file` | `String` | yes |  | The full path of the schema file. |
| `port` | `Number` | no | `8000` | The port of the HTTP server. |

Loads the FlowStream schema of the file and runs it. The HTTP server starts when at least one flow is loaded. For each flow the program prints a link to the Flow editor. When the flow is saved in the editor, the file is written again as JSON indented with tabs. A file that is not valid JSON prints `ERROR: invalid meta - <path>` and is skipped. Give the full path of the file.

Example: One file
```bash
flow5 "$PWD/flowschema.json"
# |--- http://127.0.0.1:8000
# |--- Orders: https://flow.totaljs.com/?socket=...
```

### flow5 <url> [port]

Type: `command`

Runs the flows of a schema downloaded from an https address.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `url` | `String` | yes |  | The `https://` address of the schema. |
| `port` | `Number` | no | `8000` | The port of the HTTP server. |

An argument that starts with `https://` is downloaded with a `GET` request and loaded like a file. The certificate of the server is checked. Changes made in the editor are not saved anywhere for these flows.

Example: Remote schema
```bash
flow5 https://example.com/flowschema.json 8001
```

### KEY : text

Type: `type`

The file that total5 translate writes.

A plain text file with one line for each text: the key, padded to 12 characters, then ` : ` and the text. The key is `T` followed by a hash of the text in base 36, the key that the view engine looks up for `@(text)`. Put a translated copy into `resources/` (for example `resources/sk.resource`) and translate the right side. See [Localization](../../guides/localization/).

Example: Content
```text
T1l964ro     : Hello world
T1j2ql       : Save
```

### flow5 <files...> <port>

Type: `command`

Sets the port of the Flow engine and runs several schemas at once.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `files` | `String` | yes |  | One or more schema files or addresses. |
| `port` | `Number` | no | `8000` | The port of the HTTP server. |

Arguments can come in any order. Every argument made only of digits is the port (the last one wins); every other one is a schema file, with its full path, or an `https://` address. All the flows of all the sources run in one process on that port.

Example: Several files
```bash
flow5 "$PWD/flow1.json" "$PWD/flow2.json" 8001
```

### total5 bundle <filename>

Type: `command`

Packs the current directory into a bundle file.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `filename` | `String` | yes |  | The full path of the bundle file. |

Writes the files of the current directory and its subdirectories into one `.bundle` file. `.bundle` is added to the name when it is missing. The machine files are left out (see Bundle content). Give the full path of the bundle, outside the directory you pack. The framework unpacks the bundles of `bundles/` when it starts.

Example: Pack a project
```bash
cd ~/projects/shop
total5 bundle ~/backups/shop
# ~/backups/shop.bundle
```

### { id, name, components, design } | { <id>: schema }

Type: `type`

The two shapes of a file that flow5 reads.

A file with **one flow** is an object with `components` and `design` (and `id`, `name` and the other fields of a FlowStream schema). A file with **several flows** is an object whose keys are the ids of the flows; a `variables` key is skipped. A flow without `id` gets an id made from the path. To save changes back into the file, give the flow an `id`, and in a file with several flows use the id as its key.

Example: One flow
```json
{
	"id": "orders",
	"name": "Orders",
	"components": {},
	"design": {}
}
```

Example: Several flows
```json
{
	"orders": { "id": "orders", "name": "Orders", "components": {}, "design": {} },
	"mail": { "id": "mail", "name": "Mail", "components": {}, "design": {} }
}
```

### .bundle

Type: `type`

Which files total5 bundle puts into a bundle.

All the files of the directory, except: `/index.js`, `/debug.js`, `/release.js` with their `.json` and `.pid` files, `/bundle.json`, `/package.json`, `/readme.md`, `/license.txt` and the folders `/bundles/`, `/tmp/`, `/.src/` and `/.git/`.

Example: Deploy with a bundle
```bash
total5 bundle ~/backups/shop
scp ~/backups/shop.bundle server:/www/shop/bundles/
```

### GET|POST /notify/{id}/

Type: `property`

The notification route of the Flow engine.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `String` | yes |  | `<flow id>-<instance id>[-param...]`. |

Sends a notification to a component instance of a running flow. The id is `<flow id>-<instance id>`; more parts separated with `-` arrive as `params`. The component gets the method, headers, query, body (up to 1 MB), URL and IP address. A `REDIRECT` query value redirects the visitor; a browser gets a page that closes itself, other clients get a success answer. See [FlowStream](../../guides/flowstream/).

Example: Notify a component
```bash
curl -X POST -d '{"paid":true}' -H "Content-Type: application/json" http://127.0.0.1:8000/notify/orders-c1x8a/
```

### total5 extract <filename>

Type: `command`

Unpacks a bundle into the current directory.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `filename` | `String` | yes |  | The full path of the bundle file to unpack. |

Restores all the files of the bundle into the current directory, with their subdirectories. Existing files with the same names are overwritten. When the argument is a directory, nothing happens. Give the full path of the file.

Example: Unpack
```bash
mkdir shop-copy && cd shop-copy
total5 extract ~/backups/shop.bundle
```

### SOCKET /flowstreams/{id}/

Type: `property`

The WebSocket of the Flow editor.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `String` | yes |  | The id of the flow. |

The Flow editor connects here to show and change the flow with the given id (messages up to 8 MB). The link that `flow5` prints for each flow opens `https://flow.totaljs.com/?socket=` with this address.

Example: Open the editor
```text
https://flow.totaljs.com/?socket=http%3A%2F%2F127.0.0.1%3A8000%2Fflowstreams%2Forders%2F
```
