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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bashthing-0.2.0.tar.gz.
File metadata
- Download URL: bashthing-0.2.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc138b4ecb18eacf1734da2f3f7b95ea482be5043b38702d4adc4f33fbb4eeb0
|
|
| MD5 |
19c6ff1e4302a836c245f8eb1c9ee85d
|
|
| BLAKE2b-256 |
af63b94faa88cf91fd89977b73b72d6a440273755ee1ee9f7e2385e509b81d69
|
File details
Details for the file bashthing-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bashthing-0.2.0-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6208371a910c42e7cc9f065b20e62155219dbc23cfccd79cf730ba8341bc00a
|
|
| MD5 |
19941bcd0817406015972027658d8cda
|
|
| BLAKE2b-256 |
e074afff92181d14904b503c8cd145bdd022a9a20308cd3d2e853a2e02221614
|