Python includes several modules that have a command-line interface and can be used as standalone tools.
These can be (usually) found in /usr/lib/Python3.X
.
HTTP Server
Very useful for local development or ephemeral file transfers.
Starts a simple http server on the current directory. Pass --help
for full usage help; this applies to the rest of the tools.
$ python -m http.server [port]
By the way, the PHP dev server is similar and runs PHP:
$ php -S localhost:8000
JSON tool
A simple command like interface (for the json module) to validate and pretty-print JSON objects.
$ python -m json.tool ~/.mozilla/firefox/profile/search.json /tmp/search.json
SMTP proxy
This can also be used as a makeshift SMTP server that logs all messages to the console.
# This will use `setuid` to run as `nobody` and will
# listen on port 25, localhost only.
$ sudo python -m smtpd --class DebuggingServer localhost:25
# Or run as the current user
$ python -m smtpd --nosetuid --class DebuggingServer
Other tools
pydoc
: Generate Python documentation in HTML or text for interactive use.timeit
: Tool for measuring execution time of small code snippets.uu
: UUencode and UUdecode.quopri
: Conversions to/from quoted-printable transport encoding as per RFC 1521.tabnanny
: Detect ambiguous indentation.