Getting Started - fedarovich/qbittorrent-cli GitHub Wiki
Getting Started
Installation
Install qBittorrent CLI if you have not done it yet.
Enabling qBittorrent web access
qBittorrent CLI is a command line interface for remote qBittorrent instances. In order to use it, the web access must be enabled in qBittorrent.
If you already use qBittorrent web UI, you already have web access enabled, so no additional steps are needed.
How to enable web access
-
Open qBittorrent.
-
In the main menu go to Tools > Options...
-
Select Web UI in the panel on the left side of the window.
-
Check the Web User Interface (Remote control) option.
-
Choose the port (8080 by default).
-
Enter the username (admin by default) and password (adminadmin by default).
-
Optionally enable authentication bypass for localhost and whitelisted networks.
-
Press OK to save changes.
Using qBittorrent CLI
First of all let's get a list of torrents.
In order to that, you will need qbt torrent list
command.
It accepts the following parameters:
--username
user name, e.g--username admin
--password
user password, e.g.--password adminadmin
--url
qBittorrent web UI address, e.g.--url http://localhost:8080
So in order to get the list of torrents from the local instance of qBittorrent with the default settings, you may use the following command:
qbt torrent list --username admin --password adminadmin --url http://localhost:8080
Wait! It looks too wordy for the daily use. But wait a moment, we'll simplify it now.
First of all, if you have enabled authentication bypass in your qBittorrent, you can skip username and password at all. But even if you haven't, you can configure default username and password which will be used automatically.
In order to set default username run the following command:
qbt settings set username YourLogin
where YourLogin must be substituted with your actual login.
In order to set default password run the following command:
qbt settings set password
and the application will ask you to enter your password.
You can also set the default URL:
qbt settings set url http://someaddress:8000
You must always use full absolute URL with HTTP or HTTPS scheme.
So now when you have your default settings set, you can run the simple command to get the list of torrents:
qbt torrent list
Now let's add some torrents. Just cd
to the folder where your .torrent
file resides and type the following command:
qbt torrent add file some.torrent
Of course, you can use an absolute or relative path to the torrent file too.
You can also specify several torrent files at once:
qbt torrent add file some.torrent other.torrent onemore.torrent
But what if you want to add all torrents in your folder? You can use the globbing feature of your shell to do that.
In Windows PowerShell you can do it in the following way:
qbt torrent add file (ls *.torrent)
In most Linux and macOS shells, like bash or zsh you can do it even easier:
qbt torrent add file *.torrent
or you can use the alternative way:
ls *.torrent | xargs qbt torrent add file
You can also add torrents by torrent file URLs
qbt torrent add url http://releases.ubuntu.com/18.04/ubuntu-18.04-desktop-amd64.iso.torrent
or magnet links
qbt torrent add url magnet:?xt=urn:btih:e4be9e4db876e3e3179778b03e906297be5c8dbe&dn=ubuntu-18.04-desktop-amd64.iso&tr=http%3a%2f%2ftorrent.ubuntu.com%3a6969%2fannounce&tr=http%3a%2f%2fipv6.torrent.ubuntu.com%3a6969%2fannounce
Now what if you want to pause, resume or delete your torrent. First of all, you'll need to get the torrent hash. Run qbt torrent list
command and you'll see the partial torrent hashes in the Hash column. You can use these partial hashes to manipulate your torrents. For example, the Hash column for the Ubuntu torrent above contains e4be9e
. So in order to pause this torrent you can the following command:
qbt torrent pause e4be9e
But you can actually pass even shorter string as long as it has no duplicates, e.g.:
qbt torrent pause e4b
If there is a duplicate, you'll be asked to select one of the torrents matching this partial hash.
Resuming the torrent is done in the same way:
qbt torrent resume e4be9e
The deletion command is also similar:
qbt torrent delete e4be9e
but it also has an additional option -f
which you can use to delete both the torrent and the corresponding downloaded files:
qbt torrent delete -f e4be9e
Getting help
To get help run the following command:
qbt --help
You can also get help on subcommand using the same syntax. For example, to get help on torrent add file
command run the following command:
qbt torrent add file --help