Command Line Interface¶
With the CLI you can easily upload any files or folders with globs or as an archive.
To view the source code, see the cli.py on GitHub.
To use run the sharex command from your terminal.
sharex [OPTIONS] [FILES]... # (1)!
- Tip: Save your options with Environment variables.
Install¶
- Python - Recommended if using Python or astral-sh/uv
- Homebrew - Currently downloads a binary release
- Binary Release - Download a GitHub binary release
Python¶
From PyPI: https://pypi.org/p/sharex-cli
Recommended
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
Homebrew¶
From Homebrew: https://github.com/cssnr/homebrew-tap
brew install cssnr/tap/sharex-cli
Upgrade.
brew update && brew install sharex-cli
Uninstall.
brew uninstall sharex-cli
For more details see: https://docs.brew.sh/
Binary Release¶
From GitHub: https://github.com/cssnr/sharex-cli/releases/latest
curl https://i.jpillora.com/cssnr/sharex-cli! | bash # (1)!
-
Note: the
!installs into/usr/local/bin.Omit this to use the current directory.
See jpillora/installer for more details.
Upgrade.
curl https://i.jpillora.com/cssnr/sharex-cli! | bash # (1)!
- To upgrade, install the latest release.
Uninstall.
rm -f /usr/local/bin/sharex # (1)!
- If you used the installation script above.
Manual Download
If bash is unavailable, download a release for your system.
- Windows x86_64 amd64
- macOS Apple Intel amd64
- macOS Apple Silicon arm64
- Linux x86_64 amd64
- Linux ARM arm64
After downloading, unzip the archive and move the file to /usr/local/bin or anywhere in $PATH.
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)!
- 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!