bashthing
bashthing profiles Bash scripts, identifies expensive commands and functions, and stores the results in a portable SQLite database.
Requires Python 3.14 and Bash 5 or newer. Optional system tracers may require elevated permissions.
Install
curl -LsSf uvx.sh/bashthing/install.sh | sh
Usage
bashthing profile path/to/script.sh
bashthing profile path/to/script.sh --all
bashthing optimize path/to/script.sh
profile
Profile one execution and save its trace in SQLite. The built-in DEBUG tracer is always enabled.
bashthing profile script.sh arg1 arg2 -o trace.db
bashthing profile script.sh --backend shellcheck --backend syscalls
bashthing profile script.sh --all --force
bashthing profile script.sh --input input.txt
Repeat --backend to select optional backends. --all enables every usable backend and reports why unavailable backends were skipped. Existing output files require --force; successful replacement is atomic. Use --no-report to save the trace without printing its report.
optimize
Run performance-focused linting, profile the script several times, generate a report and flamegraph, and print actionable suggestions.
bashthing optimize script.sh
bashthing optimize script.sh arg1 -n 10 -o results
bashthing optimize script.sh --input input.txt --force
The default is five profiles. Results include per-profile databases and an SVG flamegraph.
report
Print function and line-level hotspots from a saved trace.
bashthing report trace.db
bashthing report trace.db --top 50
flamegraph
Generate a standalone interactive SVG flamegraph from a saved trace.
bashthing flamegraph trace.db
bashthing flamegraph trace.db -o profile.svg
compare
Compare the wall time and hotspots of two traces.
bashthing compare baseline.db optimized.db
lint
Run bashthing's performance-focused ShellCheck rules without profiling. Requires shellcheck on PATH.
bashthing lint script.sh
Optional backends
| Name | Collects | Typical dependency |
|---|---|---|
shellcheck |
Static performance findings | ShellCheck |
syscalls |
System calls and durations | strace on Linux or dtruss on macOS |
execs |
Spawned processes | execsnoop |
probes |
Bash and operating-system probes | bpftrace on Linux or DTrace on macOS |
Explicitly requested backends must be installed and usable. Some system tracing backends require root or additional operating-system permissions.
Run bashthing --help for all commands and options.
Development instructions are in docs/contributing.md.
License
Metadata
Release files for bashthing 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bashthing-0.2.0.tar.gz | 28.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bashthing-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.4 kB
Release files / bashthing-0.2.0.tar.gz
| Download URL | bashthing-0.2.0.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc138b4ecb18eacf1734da2f3f7b95ea482be5043b38702d4adc4f33fbb4eeb0
|
|
BLAKE2b-256 checksum How to use checksums |
af63b94faa88cf91fd89977b73b72d6a440273755ee1ee9f7e2385e509b81d69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / bashthing-0.2.0-py3-none-any.whl
| Download URL | bashthing-0.2.0-py3-none-any.whl |
|---|---|
| Size | 39.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6208371a910c42e7cc9f065b20e62155219dbc23cfccd79cf730ba8341bc00a
|
|
BLAKE2b-256 checksum How to use checksums |
e074afff92181d14904b503c8cd145bdd022a9a20308cd3d2e853a2e02221614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|