Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command-line tools

The desktop package installs three programs:

ProgramPurpose
tether-cliCommand-line client of the daemon
tetherThe GTK app
tetherdThe daemon

tether-cli and tether talk to tetherd over the session D-Bus (D-Bus API). All three read environment variables.

Entries marked 0.5.0 ship with the next release. The latest release is 0.4.1.

tether-cli

tether-cli <COMMAND> [ARGUMENTS] [OPTIONS]

Global options

OptionEffect
-h, --helpPrint help for the program or for a subcommand
-V, --versionPrint the version
help [COMMAND]Same as --help

Conventions

  • <ID> is a device id or a unique prefix of one. Ids are 64 lowercase hexadecimal characters. tether-cli devices prints the first 12. A prefix that matches no device or more than one device is an error.
  • Values that are switches accept 1, true, on, yes and 0, false, off, no (case-insensitive).
  • Times are printed in UTC as YYYY-MM-DD HH:MMZ.
  • Results go to standard output, errors to standard error.

Exit status

StatusMeaning
0Success. Also used when standard output is closed early (for example by head).
1The command failed. The reason is printed as Error: <message>. D-Bus errors include the error name in parentheses.
2The command line is not valid (unknown subcommand, missing argument, bad option value).

tether-cli mirror and tether-cli app replace themselves with the GTK app. Their exit status is then that of tether.

Devices, pairing and connection

devices

tether-cli devices

Lists every device the daemon knows, one per line, with the columns ID (first 12 characters), NAME, KIND, PAIRED (yes, no), CONNECTED, BATTERY and STATE.

  • CONNECTED is yes, held (disconnected on purpose), reachable (seen on the network, not connected) or no.
  • BATTERY is a percentage, with + appended while charging, or - when unknown.
  • STATE is the pairing state: none, requested_by_us, requested_by_peer, confirming or paired.

Prints a hint instead of a table when no device is known.

watch

tether-cli watch

Prints the known devices, then one line for every signal and property change of the daemon until interrupted with Ctrl+C.

pair

tether-cli pair [-y|--yes] <ID>

Requests pairing with a device, waits up to 60 s for the phone, prints the six-digit pairing code and asks whether the codes match. An answer of y, Y or yes confirms. Anything else rejects. After confirming, the command waits up to 90 s for the phone and prints paired with <name>.

OptionEffect
-y, --yesConfirm the code without asking

When standard input is not a terminal and --yes is not given, the command fails without confirming or rejecting.

confirm

tether-cli confirm [-y|--yes] <ID>

Confirms a pairing that the phone started. Shows the code and behaves like pair from that point. Fails when no pairing is in progress with the device.

reject (alias decline)

tether-cli reject <ID> [CALL_ID]

Rejects the pairing in progress with the device. When CALL_ID is given, or when a call is ringing and no pairing is in progress, declines that call instead (see answer).

unpair

tether-cli unpair <ID>

Removes the pairing. Prints nothing on success.

connect

tether-cli connect <ID>

Dials the device’s known addresses now and clears a hold. Prints nothing on success.

disconnect

tether-cli disconnect <ID>

Closes the connection and holds it: neither side reconnects until tether-cli connect or Connect on the phone.

qr

tether-cli qr [--invert]

Prints a new pairing URI (tether://pair?…) and the same URI as a QR code drawn with Unicode block characters. The code is valid for 5 minutes and replaces any earlier one.

OptionEffect
--invertSwap light and dark modules, for terminals with a light background

add

tether-cli add <ADDRESS>

Adds a manual address (host or host:port, default port 7360), dials it and stores it in manual_addresses (Configuration and files).

self

tether-cli self

Prints the daemon’s device id, name and version, and the value of every setting that config can change.

status

tether-cli status <ID>

Prints the device’s name, connection state and hold, capabilities, Wi-Fi network and level, airplane mode, one line per SIM (carrier, network type, signal level out of 4, (data) on the data SIM), Do Not Disturb filter and whether the phone is ringing through ring. The Wi-Fi network name is always empty: the Android app does not hold the location permission that Android requires for it.

Settings

config

tether-cli config <KEY> [VALUE]

Prints a daemon setting, or changes it when VALUE is given. Prints nothing after a change. The change takes effect at once and is written to config.toml.

KeyValueDefault
nameText, not emptyThe host name
discoverableSwitchtrue
desktop-notificationsSwitchtrue
message-notificationsSwitchtrue
download-dirAbsolute path, a path starting with ~/, or empty for the default~/Downloads/Tether
auto-accept-filesSwitchtrue
clipboard-syncoff, to_phone, from_phone, bothboth
call-audio-on-pcSwitchtrue
call-ringtoneSwitchtrue
pause-media-on-callSwitchtrue

The effect of each setting is described in Configuration and files. An unknown key is an error.

Notifications

notifications

tether-cli notifications <ID>

Lists the device’s current notifications. For each: [<key>] <app> — <title> (with (conversation) for conversation notifications), the text, the path of the icon, one line per action (action <index>: <title>, with [reply] when the action takes text) and action -1: open on phone when the notification can be opened.

notify-act

tether-cli notify-act <ID> <KEY> <INDEX> [TEXT]

Triggers action INDEX of the notification KEY. Index -1 opens the notification on the phone. TEXT is the reply for an action marked [reply].

dismiss

tether-cli dismiss <ID> <KEY>

Dismisses the notification on the phone.

Messages and contacts

conversations

tether-cli conversations [--limit <N>] [--refresh] <ID>

Lists the cached conversations, newest first: thread id, time, name, unread count and the start of the last message.

OptionEffectDefault
--limit <N>Maximum number of threads. 0 lists all.50
--refreshAsk the phone for the thread list first and wait up to 15 s for it

messages

tether-cli messages [--limit <N>] [--mark-read] <ID> <THREAD>

Prints the newest messages of a thread, oldest of them first. Each line has the time, a direction marker (<- received, -> sent, .. queued, !! failed), the sender and the text. Attachments follow on their own lines with their part_id, type, size and, when already fetched, their path.

OptionEffectDefault
--limit <N>Maximum number of messages50
--mark-readMark the thread read on the desktop afterwards
tether-cli search [--limit <N>] <ID> <QUERY>

Searches the text of cached messages. Prints matches in the format of messages, with the thread id ([t<id>]) and the SIM.

OptionEffectDefault
--limit <N>Maximum number of results50

send

tether-cli send [--to <NUMBER>]... [--attach <FILE>]... [--sim <SUB_ID>]
                [--no-wait] <ID> <ADDRESS> [TEXT]...

Sends an SMS to ADDRESS. Several words of TEXT are joined with spaces. The message becomes an MMS when --attach or --to is used. Prints queued as <request id>, waits up to 65 s for the phone’s result and prints sent (message id <id>). A failed send exits with status 1.

OptionEffectDefault
--to <NUMBER>Extra recipient, repeatable (group MMS)
--attach <FILE>Attach a file, repeatable
--sim <SUB_ID>SIM subscription id (see status). -1 is the phone’s default SIM.-1
--no-waitReturn after queueing

attachment

tether-cli attachment <ID> <PART_ID>

Fetches an MMS attachment into the daemon’s cache and prints its path. Waits up to 65 s.

contacts

tether-cli contacts [--refresh] [--lookup <NUMBER-OR-EMAIL>] <ID>

Prints the number of cached contacts and one line per contact: * for starred contacts, the name, phone numbers with their type, e-mail addresses and the path of the photo.

OptionEffect
--refreshAsk the phone for changes first and wait up to 30 s
--lookup <NUMBER-OR-EMAIL>Print only the contact with this number or address

Media and phone controls

media

tether-cli media <ID> [ACTION] [POSITION_MS]

Without ACTION, lists the phone’s media sessions (the active one is marked *): app, session id, title, artist, album, position and duration in milliseconds, playing or paused, and the path of the cover art.

With ACTION, sends a command to the active session: play, pause, toggle, next, prev, stop or seek. seek takes the position in milliseconds as POSITION_MS.

volume

tether-cli volume <ID> [STREAM] [LEVEL]

Without arguments, prints every volume stream as <stream> <level>/<max>, with (muted) where it applies. With STREAM and LEVEL, sets that stream. Streams: music, ring, call, notification, alarm.

dnd

tether-cli dnd <ID> [FILTER]

Prints the Do Not Disturb filter and whether the desktop can change it, or sets it. Filters: all (off), priority, alarms, none (total silence). Changing it needs Do Not Disturb access on the phone (Android permissions and grants).

ring

tether-cli ring <ID> [stop]

Rings the phone for at most 60 s. stop (or off) ends the ringing.

clipboard

tether-cli clipboard <ID> send [TEXT]...
tether-cli clipboard <ID> get

send sets the phone’s clipboard. Without TEXT it reads standard input. get prints the last text received from the phone.

Files and photos

send-file

tether-cli send-file [--no-wait] <ID> <PATH>...

Offers the files to the phone, prints offered as <transfer id> and one progress line per update until the transfer ends (at most one hour). A transfer that fails, is cancelled or is rejected exits with status 1.

OptionEffect
--no-waitReturn after offering

transfers

tether-cli transfers <ID>

Lists active and recent transfers: id, direction, state, bytes done and total, and for each file its name, state, progress and local path.

cancel-transfer

tether-cli cancel-transfer <ID> <TRANSFER_ID>

Cancels a transfer.

accept-file

tether-cli accept-file [--reject] <ID> <TRANSFER_ID>

Answers a file offer from the phone. Offers wait for an answer only when auto-accept-files is off. The transfer id is printed by watch.

OptionEffect
--rejectReject the offer

photos

tether-cli photos [--limit <N>] [--album <NAME>] <ID> [KIND]

Lists gallery items: id, time, name, dimensions, size, album and the path of a cached thumbnail. KIND is all (default), image, video or screenshot. When the index is empty the command asks the phone and waits up to 20 s. The last line gives the number of items and (more available) when the limit cut the list.

OptionEffectDefault
--limit <N>Maximum number of items50
--album <NAME>Only items of this albumall albums

albums

tether-cli albums <ID>

Prints the album names in the index, one per line.

thumb

tether-cli thumb [--size <PIXELS>] <ID> <MEDIA_ID>

Fetches a thumbnail and prints its path. Waits up to 30 s.

OptionEffectDefault
--size <PIXELS>Longest edge256

fetch

tether-cli fetch <ID> <MEDIA_ID>

Downloads the original into the daemon’s cache and prints its path. Waits up to 10 minutes.

delete-photo

tether-cli delete-photo <ID> <MEDIA_ID>...

Deletes gallery items on the phone and prints which ids were deleted and which failed. Without all-files access the phone asks for confirmation on its screen, and the command waits up to 2 minutes.

Calls and Bluetooth

calls

tether-cli calls <ID>

Prints the current calls and a summary line. A call line has the form [<call id>] <status> <direction> <who> route=<route>, followed by flags (muted, audio on pc, the duration of an active call). The summary line shows whether calls can be controlled, whether dialling is possible, where the call audio is, the number of unseen missed calls and the Bluetooth state and address.

answer, hangup, silence

tether-cli answer <ID> [CALL_ID]
tether-cli hangup <ID> [CALL_ID]
tether-cli silence <ID> [CALL_ID]

answer answers the ringing call, hangup ends the current call, silence stops the ringing on the phone and the desktop without declining. CALL_ID selects a call when there are several. Each prints <action>: ok, or fails with the phone’s reason when the phone reports a failure within 3 s. To decline a call, use reject.

dial

tether-cli dial [--sim <SUB_ID>] <ID> <NUMBER>

Places a call from the phone. Prints the request id and, once the phone reports the outgoing call (up to 16 s), its call line.

OptionEffectDefault
--sim <SUB_ID>SIM subscription id. -1 is the phone’s default.-1

mute

tether-cli mute [--call <CALL_ID>] <ID> <on|off>

Mutes or unmutes the phone’s microphone during a call.

audio

tether-cli audio [--call <CALL_ID>] <ID> <pc|phone|speaker>

Moves the call audio to the desktop, to the phone’s earpiece or to the phone’s loudspeaker, then prints the resulting call audio: value. pc and speaker need the MANAGE_ONGOING_CALLS grant (Android permissions and grants).

calllog

tether-cli calllog [--missed] [--limit <N>] [--seen] <ID>

Prints the cached call log, newest first: time, type, duration, name and number, (new) for unseen missed calls. The last line gives the number of unseen missed calls.

OptionEffectDefault
--missedOnly missed calls
--limit <N>Maximum number of entries30
--seenMark missed calls seen afterwards

bt

tether-cli bt <ID> [status|pair|connect|disconnect]
ActionEffect
status (default)Print the Bluetooth state, the phone’s Bluetooth address and where call audio is
pairStart Bluetooth pairing with the phone and follow it. Prints the code to compare. Waits up to 4 minutes.
connectConnect the hands-free link and print the state
disconnectDisconnect it and print the state

Enhanced tier

These commands need a phone that announces the enhance capability and a working adb on the desktop.

enhance

tether-cli enhance [--invert] <ID> [ACTION] [ARG]
ActionEffect
status (default)Print the adb state and version, the enhanced state with its detail, the adb serial, the transport (usb or wifi), whether Wireless debugging can be switched on again through the app, the shell helper’s abilities and the open mirrors
setupLink the adb device to this phone and start the shell helper, then print the status
pairPrint a QR code for Pair device with QR code in the phone’s Wireless debugging settings and follow the pairing for up to 5.5 minutes. Ctrl+C cancels.
code <CODE>Pair with the six-digit code from Pair device with pairing code instead. Waits up to 2 minutes.
grantsPrint every grant as granted or missing
grants applyApply all missing grants, then print them
restartRestart the shell helper, then print the status
rearmAsk the phone to switch Wireless debugging on
OptionEffect
--invertSwap light and dark modules of the QR code printed by pair

The grants are listed in Android permissions and grants.

mirror

tether-cli mirror [--screen-off] <ID>

Opens the phone’s screen in a window. The command checks that the enhanced state is ready and then runs tether --mirror <device id>.

OptionEffect
--screen-offSwitch the phone’s own screen off while it is mirrored

apps

tether-cli apps [--system] <ID>

Lists the phone’s launchable apps as package name and label.

OptionEffect
--systemInclude preinstalled apps

app

tether-cli app <ID> <PACKAGE>

Opens one phone app in its own window. The command checks that the enhanced state is ready and that the shell helper has the ability display.new, then runs tether --app <device id> <package>.

phone-audio

tether-cli phone-audio <ID> [on|off]

Prints whether the phone’s audio plays on the desktop, with the state and its detail. With on or off, changes the switch first and waits up to 8 s for the state to settle.

webcam (0.5.0)

tether-cli webcam <ID> [ACTION] [ARG]
ActionEffect
status (default)Print the switch, the state, the stream in use and the settings
on, offSwitch the webcam and wait up to 10 s for the state to settle
camerasList the phone’s cameras: id, facing, sensor orientation, sizes, frame rates, maximum zoom, torch
camera <front|back|ID>Choose the camera
rotate <0|90|180|270>Rotate the picture clockwise (rotation is accepted too)
flip <on|off>Mirror the picture horizontally
torch <on|off>Switch the torch
zoom <FACTOR>Zoom factor of 1.0 or more. A trailing x is accepted.

Every action except cameras ends by printing the status. Only one phone can be the webcam at a time.

webcam-setup (0.5.0)

tether-cli webcam-setup [status|load|persist|remove]
ActionEffect
status (default)Check again and print the state of the virtual camera
loadCreate the virtual camera device now
persistCreate it now and at every boot
removeDelete the files that create it at boot

load, persist and remove ask for an administrator password through polkit. The output shows the state (unsupported, not_installed, not_loaded, no_device, ready), the device node, whether the device is created at every boot and which phone uses it.

tether

tether [OPTIONS]

Without options, tether opens the main window. A second start while the app runs presents the existing window.

OptionEffect
-b, --backgroundStart without showing the window. The autostart entry uses this option.
--mirror <DEVICE-ID>Open the phone-screen window of a device. The id may be a unique prefix. In a running app the window opens there and the command returns.
--screen-offWith --mirror: switch the phone’s own screen off while it is shown
--app <DEVICE-ID> <PACKAGE>Open one phone app in its own window, likewise. Pinned launchers use this option.
--mockRun against a built-in fake daemon. Needs a build with the mock feature.
-h, --helpPrint the options, including the standard GTK application options

A malformed --app prints a usage line and exits with status 2.

tetherd

tetherd [-V|--version]
OptionEffect
-V, --versionPrint tetherd <version> and exit

tetherd has no other options and ignores other arguments. It runs until it receives SIGTERM or SIGINT. It exits with a non-zero status when config.toml cannot be parsed, when the session bus is not available or when another instance owns the bus name. Settings come from config.toml and the environment.

Environment variables

All users

VariableRead byEffect
RUST_LOGtetherd, tetherLog filter in the syntax of the Rust tracing crate, for example info, debug or tetherd=debug,tether_core=trace. Default: info for tetherd (the systemd unit sets the same), tether=info,tether_gtk=info,warn for tether. Logs go to standard error.
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOMEtetherd, tetherBase directories of the files. Defaults: ~/.config, ~/.local/share, ~/.cache.
XDG_DOWNLOAD_DIRtetherdWhen set, the default download directory is $XDG_DOWNLOAD_DIR/Tether.
XDG_RUNTIME_DIRtetherdDirectory of the temporary echo-canceller configuration during calls
HOMEtetherd, tetherFallback for the directories above and for ~/ in download_dir
PATHtetherdSearch path for adb and the helper programs listed in Supported platforms
ANDROID_HOME, ANDROID_SDK_ROOTtetherdadb is also looked for in <dir>/platform-tools/
ANDROID_ADB_SERVER_PORTtetherdPort of your own adb server when adb_server = "shared". Default 5037.
WAYLAND_DISPLAY, DISPLAYtetherdSelect the clipboard tool (wl-copy or xclip). The clipboard watcher of the daemon runs only on X11.
TETHER_VIDEO_DECODERtetherd, tetherName of a GStreamer H.264 decoder element to try before the built-in list (vah264dec, nvh264dec, v4l2slh264dec, avdec_h264, openh264dec). Used by the mirror windows and, from 0.5.0, the webcam.
TETHER_APPtether-cliProgram that mirror and app start. Default: tether next to tether-cli, else tether on PATH.

Development only

These variables exist for running a second daemon next to an installed one and for testing. Do not set them for normal use.

VariableRead byEffect
TETHER_BUS_NAMEtetherd, tether-cliD-Bus name to own or to talk to instead of org.tether.Daemon, for example org.tether.Debug
TETHER_PORTtetherdTCP and UDP port, overriding port in config.toml
TETHER_PEER_PORTtetherdPort a phone that dialled in is assumed to listen on. Default 7360.
TETHER_ADB_PORTtetherdPort of the private adb server, overriding adb_server_port
TETHER_WEBCAM_SETUP (0.5.0)tetherdPath of the virtual camera set-up script, instead of /usr/libexec/tether/tether-webcam-setup
TETHER_TEST_WEBCAM_DEVICE (0.5.0)tetherd test suiteDevice node for one optional test. Not read by the installed program.

The following variables change the fake daemon of tether --mock and have no effect without it. The tether-gtk README describes what the fake daemon does.

VariableValuesEffect
TETHER_MOCK_QUIETanyNo scripted pairing request or reply requests
TETHER_MOCK_BToff, unavailable, unpaired (default), paired, connectedInitial Bluetooth state
TETHER_MOCK_FIRST_CALLseconds (default 12)Delay of the first fake incoming call
TETHER_MOCK_ENHANCEDan enhanced state (default ready)Initial state of the enhanced tier
TETHER_MOCK_ADBmissing, too_oldState of adb
TETHER_MOCK_APPSempty, errorApp list without apps, or an app list that fails to load
TETHER_MOCK_AUDIOunsupported, error, playback, playback_dupResult of switching phone audio on
TETHER_MOCK_ROTATEseconds (default 9); 0 for neverDelay of the fake screen rotation
TETHER_MOCK_WEBCAM_SETUP (0.5.0)not_installed, not_loaded (default), no_device, ready, unsupportedInitial state of the virtual camera
TETHER_MOCK_WEBCAM_SETUP_RESULT (0.5.0)fail, cancelResult of the set-up action
TETHER_MOCK_WEBCAM (0.5.0)unsupported, error, busyResult of switching the webcam on
TETHER_MOCK_CAMERAS (0.5.0)number (default 2)Number of fake cameras