LinuxCommandLibrary

mktorrent

creates BitTorrent metainfo files

TLDR

Create torrent from file

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

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 auto).
-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.

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community