mktorrent

creates BitTorrent metainfo files

TLDR

Create torrent from file
$ mktorrent -a [http://tracker.example.com/announce] [file]
Create torrent from directory
$ mktorrent -a [http://tracker.example.com/announce] [directory/]
Create with multiple trackers
$ mktorrent -a [tracker1] -a [tracker2] [file]
Create private torrent
$ mktorrent -p -a [http://tracker.example.com/announce] [file]
Specify piece length
$ mktorrent -l [20] [file]
Add web seed
$ mktorrent -w [http://example.com/file] -a [tracker] [file]
Create with comment
$ mktorrent -c "[My torrent]" -a [tracker] [file]
Specify output filename
$ mktorrent -o [output.torrent] -a [tracker] [file]
Verbose output
$ mktorrent -v -a [tracker] [file]

SYNOPSIS

mktorrent [-a tracker] [-p] [-l piecelength] [-o output.torrent] [options] path_

DESCRIPTION

mktorrent creates BitTorrent metainfo (.torrent) files. It hashes the content and packages file information with tracker details.The tool calculates piece hashes for file verification. Piece length affects swarm efficiency - larger pieces reduce overhead but delay initial sharing. Auto-selection usually works well.Multiple trackers provide redundancy. When one tracker is down, clients try others. Private torrents disable DHT and peer exchange, requiring tracker-only operation.Web seeds provide HTTP fallback when peers are unavailable. They're useful for initial seeding or low-popularity torrents.The source tag helps private trackers identify torrents from their site. It's embedded in the info dictionary, becoming part of the info hash.Creation is fast for small files but may take time for large datasets due to hashing requirements.

PARAMETERS

-a URL

Tracker announce URL.
-o FILE
Output torrent file.
-p
Private torrent (no DHT/PEX).
-l N
Piece length as power of 2 (default 18, i.e. 256KB).
-c TEXT
Comment.
-n NAME
Name in torrent (default: path basename).
-w URL
Web seed URL.
-s TEXT
Source tag for private trackers.
-v
Verbose output.
-t THREADS
Number of threads for hashing.
-d
Don't write creation date.
-h
Show help screen.

INSTALL

sudo apt install mktorrent
sudo dnf install mktorrent
sudo pacman -S mktorrent
sudo apk add mktorrent
sudo zypper install mktorrent
brew install mktorrent
nix profile install nixpkgs#mktorrent

CAVEATS

Changing any content after creation invalidates the torrent. Private tracker torrents not interoperable with public. Large piece sizes delay initial piece completion.

HISTORY

mktorrent was written as a lightweight, fast torrent creator. It provides command-line access to torrent creation without requiring a full BitTorrent client.

SEE ALSO

transmission-create(1), rtorrent(1), aria2c(1)