Skip to content

Command Line Interface

ShareX CLI

With the CLI you can easily upload any files or folders with globs or as an archive.

To get started see the Install, Configure and Upload guides.

To view the source code, see the cli.py on GitHub.

To use run the sharex command from your terminal.

sharex [OPTIONS] [FILES]...  # (1)!
  1. Tip: Save your options with Environment variables.

Install

If you have Python or astral-sh/uv installed, you should install using Python.

Otherwise, you can Download a binary release for your system.

Python

From PyPI: https://pypi.org/p/sharex-cli

pip install sharex-cli
uv tool install sharex-cli

From GitHub: https://github.com/cssnr/sharex-cli

pip install git+https://github.com/cssnr/sharex-cli.git
uv tool install git+https://github.com/cssnr/sharex-cli.git

From source.

git clone https://github.com/cssnr/sharex-cli.git
pip install sharex-cli
git clone https://github.com/cssnr/sharex-cli.git
uv pip install install sharex-cli

Upgrade.

pip install -U sharex-cli
uv tool upgrade sharex-cli

Uninstall.

pip uninstall sharex-cli
uv tool uninstall sharex-cli

Download

Download a Release: https://github.com/cssnr/sharex-cli/releases/latest

To install a binary release, unzip the archive and place the file in your PATH.

Unix: the file should already be executable, if not run chmod +x sharex.

If you need additional help, support is available.

Configure

To configure you need your server's ShareX Custom Uploader *.sxcu configuration JSON.

The app will automatically enter configuration on the first run.

sharex

This allows you to enter a file path, or open a text editor to enter the contents.

To re-configure pass the --config flag.

sharex --config

You can also pass the path to the config file.

sharex --config path/to/config.sxcu

You can then press Enter to open a text editor or paste the config path.

$ sharex

Download your servers ShareX Custom Uploader (*.sxcu) configuration, then:

 - Type or Paste the config file path.
 - Press Enter to open a text editor.
 - Or press Ctrl+C to abort.

File Path:

Server Support Request

If your server is not supported, please submit Server Support feature request.

Upload

Upload a file run the sharex command with the path to the file to upload.

sharex file.txt

Upload a file with a custom filename.

sharex file.txt -n other.txt

Upload multiple files.

sharex file1.txt file2.txt

Upload files in a directory (default glob: *).

sharex dir1

Upload files in a directory matching a glob.

sharex dir1 -g '*.md'

Upload files in a directory recursively (use any recursive glob).

sharex dir1 -g '**'

Create an archive of a directory to upload.

sharex dir1 -a

Don't launch the file in the browser.

sharex file.txt -nl  # (1)!
  1. Tip: Save your options with Environment variables.

Create text file from standard input.

echo "test text" | sharex -n test.txt

Create text file from clipboard or text.

sharex
# Paste or type contents here followed by a newline
# Then press Ctrl+D (Windows press Ctrl+Z then Enter)

Environment

Many options support setting environment variable defaults.

Environment Variable Default Type Description
SHAREX_COPY 1 bool Copy URL to Clipboard
SHAREX_LAUNCH 1 bool Launch URL in Browser
SHAREX_YES 0 bool Answer YES to Prompts
SHAREX_VERBOSE 0 bool Verbose Output
SHAREX_CONFIG - str JSON Config Data

Allowed boolean values, case-insensitive.

0, 1, f, false, n, no, off, on, t, true, y, yes

You can set variables on the command line.

export SHAREX_VERBOSE=1
$env:SHAREX_VERBOSE=1

 

To see the help use the --help flag.

$ sharex --help

 Usage: sharex [OPTIONS] [FILES]...

 Files: A File, Multiple Files or a Directory.

┌─ Arguments ──────────────────────────────────────────────────────────────────────┐
│   files      [FILES]...  Files or Directory...                                   │
└──────────────────────────────────────────────────────────────────────────────────┘
┌─ Options ────────────────────────────────────────────────────────────────────────┐
│ --name     -n                    File Name (sent with upload).                   │
│ --glob     -g                    Directory Files Glob (use ** to recurse).       │
│                                  [default: *]                                    │
│ --archive  -a                    Directory Create Archive (no glob support).     │
│ --yes      -y                    Answer YES to Prompts. [env var: SHAREX_YES]    │
│ --copy     -c  --no-copy    -nc  Copy URL to Clipboard. [env var: SHAREX_COPY]   │
│                                  [default: copy]                                 │
│ --launch   -l  --no-launch  -nl  Launch URL in Browser. [env var: SHAREX_LAUNCH] │
│                                  [default: launch]                               │
│ --verbose  -v                    Verbose Output. [env var: SHAREX_VERBOSE]       │
│ --config   -C                    Update Configuration.                           │
│ --version  -V                    Show Installed Version.                         │
│ --help     -h                    Show this message and exit.                     │
└──────────────────────────────────────────────────────────────────────────────────┘

In the terminal output is scaled and displays properly.

 

Question

If you need help getting started or run into any issues, support is available!