如何在 Linux 上查看 torrent 文件内容
问题:我有一个从网上下载的 torrent 文件。有没有一种工具可以让我在 Linux 上查看 torrent 的内容?例如,我想知道 torrent 中包含哪些文件。
torrent 文件(即带有 .torrent
扩展名的文件)是 BitTorrent 元数据文件,它存储 BitTorrent 客户端下载在 BitTorrent 对等网络上共享的文件所需的信息(例如,跟踪器 URL、文件列表、大小、校验和、创建日期)。在单个 torrent 文件内,可以列出一个或多个文件以供共享。
torrent 文件的内容使用 BEncode(BitTorrent 的数据序列化格式)进行编码。因此,要查看 torrent 文件的内容,您需要相应的解码器。
事实上,任何基于 GUI 的 BitTorrent 客户端(例如 Transmission 或 uTorrent)都配备了 BEncode 解码器,因此可以通过打开 torrent 文件向您显示其内容。但是,如果您不想使用任何类型的 BitTorrent 客户端来检查 torrent 文件,则可以尝试名为 dumptorrent
的命令行 torrent 查看器。
dumptorrent
命令通过使用内置的 BEncode 解码器打印 torrent 文件的详细内容(例如文件名、大小、跟踪器 URL、创建日期、信息哈希等)。
在 Linux 上安装 DumpTorrent
要在 Linux 上安装 dumptorrent
,您可以从源代码构建它。
在 Debian、Ubuntu 或 Linux Mint 上:
$ sudo apt-get install gcc make
$ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz
$ tar -xvf dumptorrent-1.2.tar.gz
$ cd dumptorrent-1.2
$ make
$ sudo cp dumptorrent /usr/local/bin
在 CentOS、Fedora 或 RHEL 上:
$ sudo yum install gcc make
$ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz
$ tar -xvf dumptorrent-1.2.tar.gz
$ cd dumptorrent-1.2
$ make
$ sudo cp dumptorrent /usr/local/bin
确保 /usr/local/bin
包含在您的 PATH
中。
查看 Torrent 的内容
要检查 torrent 的内容,只需将 torrent 文件作为参数运行 dumptorrent
即可。这将打印 torrent 的摘要,包括文件名、大小和跟踪器 URL。
$ dumptorrent <torrent-file>

要查看 torrent 的完整内容,请添加 -v
选项。这将打印 torrent 的更详细信息,包括信息哈希、片段长度、创建日期、创建者和完整公告列表。
$ dumptorrent -v <torrent-file>
