# Command reference

`fuzzy` is both the server and its client. `fuzzy serve` starts the server. Any other command acts as a client, and `fuzzy` alone on a terminal shows help. `fuzzy help` lists the commands, and `fuzzy help COMMAND` or `fuzzy COMMAND -h` shows one command's flags.

Flags may come before or after the arguments: `fuzzy put report.pdf --ttl 1h` and `fuzzy put --ttl 1h report.pdf` are the same.

## Shared flags

Every client command accepts `--url` and `--key` (all but `register`, which has no key yet). They override the environment and the saved login. See [Configuration](cli-config.md) for the order.

## login

Save the server address and your key after checking them.

```sh
fuzzy login
echo "$KEY" | fuzzy login
```

The server is the one the installer saved, or the one you pass with `--url`. On a terminal you are asked for the access key (hidden); with no server known at all you are asked for that first.

| Flag | Meaning |
|---|---|
| `--url URL` | Server address, for the first sign-in or to switch servers |
| `--key KEY` | Your key. Without it, read from standard input when piped, or prompted (hidden when the terminal allows) |

## server

Show or set the default server, so the other commands (and `fuzzy login`) know where to go.

```sh
fuzzy server                       # print the default server
fuzzy server https://fuzzyshare.com              # make it the default
```

| Flag | Meaning |
|---|---|
| `--if-unset` | Save the address only when none is saved yet (the installer uses this) |
| `--no-check` | Skip asking the server whether it answers |

An access key belongs to one server. Setting a different server signs you out of the old one, so a key is never sent anywhere it was not issued. The same rule applies to `--url` and `FUZZY_URL`: a saved key is only used for the server it was saved with.

## register

Create an account and print its key on standard output. The key is shown once. On a server that confirms email addresses, it prints nothing but a note: open the emailed link, copy the key it shows, then run `fuzzy login`. It is saved as your login only when none is saved yet.

```sh
fuzzy register --name "Ada Lovelace" --email ada@example.com
```

| Flag | Meaning |
|---|---|
| `--name N` | Your full name (required) |
| `--email E` | Your email address (required) |
| `--key-name K` | Name for the first key (default `default`) |
| `--signup-code C` | If the server requires one. Default `$FUZZY_SIGNUP_CODE` |
| `--url URL` | Server address |

## whoami

Show the account, the key in use (name and fingerprint) and usage.

```sh
fuzzy whoami
fuzzy whoami --json
```

## put

Upload a file, or standard input with `-`.

```sh
fuzzy put report.pdf --ttl 7d
URL=$(fuzzy put report.pdf --ttl 1h --share)
tar c dir | fuzzy put - --name dir.tar --public
```

| Flag | Meaning |
|---|---|
| `--name N` | Name on the server. Default: the file's name. Required with `-` |
| `--ttl 1h` | How long to keep the file (`90m`, `24h`, `7d`; 14 days at most) |
| `--public` / `--private` | Public: anyone with the URL can read. Private: readers need the passphrase or an allowed key |
| `--share` | Create a link and print its URL |
| `--passphrase P` | Private link with a passphrase. Visible in process lists: prefer `FUZZY_PASSPHRASE` with `--private` |
| `--allow FP` | Fingerprint of a key allowed to read (repeatable). Makes the link private |
| `--max-downloads N` | The link stops working after N downloads |
| `--label L` | A note shown in `fuzzy links` |

How `put` decides what to do:

- **No link options:** uploaded, private to you, nothing printed on standard output.
- **`--public` alone:** uploaded public; the public URL is printed.
- **`--private` alone:** uploaded private.
- **`--share`, `--passphrase`, `--allow`, `--max-downloads` or `--label`:** uploaded, then a link is made (public unless a passphrase, an allow-list or `--private` makes it private) and its URL is printed. A private link needs a passphrase or `--allow`.

## get

Download one of your files.

```sh
fuzzy get report.pdf
fuzzy get report.pdf -o ~/Downloads/
fuzzy get report.pdf -o - | head
```

`-o` takes a path, a directory, or `-` for standard output. The file is written under a temporary name and renamed when complete, so a failure leaves no partial file and never damages an existing one.

## ls

List your files with size, visibility, link count, the key that uploaded each and time to expiry.

```sh
fuzzy ls
fuzzy ls --json
```

## rm

Delete files now. Their links stop working. It keeps going after a failure and exits `1` if any failed.

```sh
fuzzy rm report.pdf notes.txt
```

## share

Make a link to a file and print only its URL. Without options the link is public.

```sh
fuzzy share report.pdf --ttl 1h
fuzzy share report.pdf --passphrase "correct horse battery" --max-downloads 1
fuzzy share report.pdf --allow sha256:9f2c4ab01d3e7f58 --label "for Sam"
```

It takes the same link flags as `put` (`--ttl` here is the link's lifetime, shorter than the file's).

## links

List active links, all or one file's. Private links show no URL: it was shown once.

```sh
fuzzy links
fuzzy links report.pdf --json
```

The columns are `ID`, `FILE`, `ACCESS`, `VIEWS`, `DOWNLOADS`, `EXPIRES`, `LABEL`, `URL`.

## activity

See who opened a link: one row per visitor session.

```sh
fuzzy activity l_0123456789ab
fuzzy activity l_0123456789ab --json
```

A visitor is named only when they presented their own key. Preview bots are marked "bot". The operator decides whether IPs are logged in full, masked or not at all. See [Access activity and privacy](concepts-activity.md).

## unshare

Revoke links by id.

```sh
fuzzy unshare l_0123456789ab l_ba9876543210
```

## keys

Manage your named access keys.

```sh
fuzzy keys ls                # with fingerprints
fuzzy keys add ci-bot        # printed once on standard output
fuzzy keys rm k_37ea501438da # not allowed for your only key
```

## fetch

Read a share link (`/s/TOKEN`, `/raw` and `/info` forms). The file is saved under the name the server gives it.

```sh
fuzzy fetch https://fuzzyshare.com/s/TOKEN
fuzzy fetch https://fuzzyshare.com/s/TOKEN --passphrase "correct horse battery" -o -
```

| Flag | Meaning |
|---|---|
| `--passphrase P` | Passphrase of a private link. Default `$FUZZY_PASSPHRASE` |
| `-o PATH` | A path, a directory, or `-` for standard output |

`fetch` sends your saved key to a private link only if the link asks for a key and lives on the server you are logged in to. A key is never sent to another host.

## version

Print the version, the commit and the system the binary was built for.

## update

Replace the binary with the newest build from the server. `--check` only reports. See [Install the CLI](cli-install.md#update).

## completion

Print a completion script for `bash`, `zsh`, `fish` or `powershell`. See [Install the CLI](cli-install.md#shell-completion).

## serve

Start the server. This is what the systemd unit and the Docker image run. See [Self-hosting](self-hosting-install.md).
