dbxcli is a command-line client for Dropbox. It makes it possible to manage Dropbox files directly from a terminal, which is useful on servers, remote machines, or any environment where using the web interface is inconvenient.
Its main capabilities include:
- Basic file operations such as
ls,cp,mkdir, andmv - File search
- File revision lookup and restore
- Chunked uploads for large files, and paginated listing for large directories
Installing dbxcli
Download the binary for your system from the official release page. On a Linux amd64 system, the installation can be done like this:
wget https://github.com/dropbox/dbxcli/releases/download/v3.0.0/dbxcli-linux-amd64
mv dbxcli-linux-amd64 /usr/local/bin/dbxcli
chmod +x /usr/local/bin/dbxcli
After that, dbxcli can be called directly from the command line.
Linking a Dropbox account
Use dbxcli account to connect dbxcli with a Dropbox account. After running the command, it will display a URL. Open the URL in a browser, authorize the application, then copy the API request authorization code shown by Dropbox back into the terminal to complete verification.
➜ ~ dbxcli account
1. Go to https://www.dropbox.com/1/oauth2/authorize?client_id=07****jfsd***f9&response_type=code&state=state
2. Click "Allow" (you might have to log in first).
3. Copy the authorization code.
Enter the authorization code here: bR***miYqHoA******yDLEyh2ft3d*********
Logged in as bbq <[email protected]>
Account Id: dbid:AACE7******7UoEko
Account Type: basic
Locale: zh-CN
Referral Link: https://www.dropbox.com/referrals/***XJRk**********XewBy2b9******Of8c?src=app9-934508
Profile Photo Url:
Paired Account: false
➜ ~
Checking Dropbox storage usage
The du command shows the current usage of the Dropbox account, including used space, account type, and allocated storage:
➜ ~ dbxcli du
Used: 3.2 GiB
Type: individual
Allocated: 20 GiB
Common file operations
dbxcli provides a set of familiar commands for working with remote Dropbox files and folders:
cp 复制文件
get 下载文件
ls 列出文件
mkdir 创建目录
mv 移动文件
put 上传文件
restore 恢复文件
revs 查询修改记录
rm 移除文件
search 搜索
For example, the following commands upload a file to Dropbox, list the target directory, check the file revision, and then download the same file back:
➜ ~ dbxcli put v2rayN-windows-64.7z /updir/v2rayN-windows-64.7z
Uploading 41 MiB/41 MiB
➜ ~ dbxcli ls /updir/
/updir/v2rayN-windows-64.7z
➜ ~ dbxcli revs /updir/v2rayN-windows-64.7z
637ab1d715d691d1ce78a
➜ ~ dbxcli get /updir/v2rayN-windows-64.7z
Downloading 41 MiB/41 MiB
Team management commands
Besides personal file operations, dbxcli also includes team management features. The team --help command lists the available team-related subcommands, such as adding or removing members, viewing team information, and listing groups or members.
➜ ~ dbxcli team --help
Team management commands
Usage:
dbxcli team [command]
Available Commands:
add-member 添加成员
info 团队信息
list-groups 组信息
list-members 组成员
remove-member 移除组成员
Flags:
-h, --help help for team
Global Flags:
--as-member string Member ID to perform action as
-v, --verbose Enable verbose logging
Use "dbxcli team [command] --help" for more information about a command.