Command-line tools
The desktop package installs three programs:
| Program | Purpose |
|---|---|
tether-cli | Command-line client of the daemon |
tether | The GTK app |
tetherd | The 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
| Option | Effect |
|---|---|
-h, --help | Print help for the program or for a subcommand |
-V, --version | Print 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 devicesprints 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,yesand0,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
| Status | Meaning |
|---|---|
| 0 | Success. Also used when standard output is closed early (for example by head). |
| 1 | The command failed. The reason is printed as Error: <message>. D-Bus errors include the error name in parentheses. |
| 2 | The 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.
CONNECTEDisyes,held(disconnected on purpose),reachable(seen on the network, not connected) orno.BATTERYis a percentage, with+appended while charging, or-when unknown.STATEis the pairing state:none,requested_by_us,requested_by_peer,confirmingorpaired.
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>.
| Option | Effect |
|---|---|
-y, --yes | Confirm 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.
| Option | Effect |
|---|---|
--invert | Swap 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.
| Key | Value | Default |
|---|---|---|
name | Text, not empty | The host name |
discoverable | Switch | true |
desktop-notifications | Switch | true |
message-notifications | Switch | true |
download-dir | Absolute path, a path starting with ~/, or empty for the default | ~/Downloads/Tether |
auto-accept-files | Switch | true |
clipboard-sync | off, to_phone, from_phone, both | both |
call-audio-on-pc | Switch | true |
call-ringtone | Switch | true |
pause-media-on-call | Switch | true |
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.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of threads. 0 lists all. | 50 |
--refresh | Ask 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.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of messages | 50 |
--mark-read | Mark the thread read on the desktop afterwards |
search
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.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of results | 50 |
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.
| Option | Effect | Default |
|---|---|---|
--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-wait | Return 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.
| Option | Effect |
|---|---|
--refresh | Ask 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.
| Option | Effect |
|---|---|
--no-wait | Return 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.
| Option | Effect |
|---|---|
--reject | Reject 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.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of items | 50 |
--album <NAME> | Only items of this album | all 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.
| Option | Effect | Default |
|---|---|---|
--size <PIXELS> | Longest edge | 256 |
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.
| Option | Effect | Default |
|---|---|---|
--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.
| Option | Effect | Default |
|---|---|---|
--missed | Only missed calls | |
--limit <N> | Maximum number of entries | 30 |
--seen | Mark missed calls seen afterwards |
bt
tether-cli bt <ID> [status|pair|connect|disconnect]
| Action | Effect |
|---|---|
status (default) | Print the Bluetooth state, the phone’s Bluetooth address and where call audio is |
pair | Start Bluetooth pairing with the phone and follow it. Prints the code to compare. Waits up to 4 minutes. |
connect | Connect the hands-free link and print the state |
disconnect | Disconnect 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]
| Action | Effect |
|---|---|
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 |
setup | Link the adb device to this phone and start the shell helper, then print the status |
pair | Print 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. |
grants | Print every grant as granted or missing |
grants apply | Apply all missing grants, then print them |
restart | Restart the shell helper, then print the status |
rearm | Ask the phone to switch Wireless debugging on |
| Option | Effect |
|---|---|
--invert | Swap 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>.
| Option | Effect |
|---|---|
--screen-off | Switch 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.
| Option | Effect |
|---|---|
--system | Include 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]
| Action | Effect |
|---|---|
status (default) | Print the switch, the state, the stream in use and the settings |
on, off | Switch the webcam and wait up to 10 s for the state to settle |
cameras | List 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]
| Action | Effect |
|---|---|
status (default) | Check again and print the state of the virtual camera |
load | Create the virtual camera device now |
persist | Create it now and at every boot |
remove | Delete 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.
| Option | Effect |
|---|---|
-b, --background | Start 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-off | With --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. |
--mock | Run against a built-in fake daemon. Needs a build with the mock feature. |
-h, --help | Print the options, including the standard GTK application options |
A malformed --app prints a usage line and exits with status 2.
tetherd
tetherd [-V|--version]
| Option | Effect |
|---|---|
-V, --version | Print 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
| Variable | Read by | Effect |
|---|---|---|
RUST_LOG | tetherd, tether | Log 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_HOME | tetherd, tether | Base directories of the files. Defaults: ~/.config, ~/.local/share, ~/.cache. |
XDG_DOWNLOAD_DIR | tetherd | When set, the default download directory is $XDG_DOWNLOAD_DIR/Tether. |
XDG_RUNTIME_DIR | tetherd | Directory of the temporary echo-canceller configuration during calls |
HOME | tetherd, tether | Fallback for the directories above and for ~/ in download_dir |
PATH | tetherd | Search path for adb and the helper programs listed in Supported platforms |
ANDROID_HOME, ANDROID_SDK_ROOT | tetherd | adb is also looked for in <dir>/platform-tools/ |
ANDROID_ADB_SERVER_PORT | tetherd | Port of your own adb server when adb_server = "shared". Default 5037. |
WAYLAND_DISPLAY, DISPLAY | tetherd | Select the clipboard tool (wl-copy or xclip). The clipboard watcher of the daemon runs only on X11. |
TETHER_VIDEO_DECODER | tetherd, tether | Name 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_APP | tether-cli | Program 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.
| Variable | Read by | Effect |
|---|---|---|
TETHER_BUS_NAME | tetherd, tether-cli | D-Bus name to own or to talk to instead of org.tether.Daemon, for example org.tether.Debug |
TETHER_PORT | tetherd | TCP and UDP port, overriding port in config.toml |
TETHER_PEER_PORT | tetherd | Port a phone that dialled in is assumed to listen on. Default 7360. |
TETHER_ADB_PORT | tetherd | Port of the private adb server, overriding adb_server_port |
TETHER_WEBCAM_SETUP (0.5.0) | tetherd | Path of the virtual camera set-up script, instead of /usr/libexec/tether/tether-webcam-setup |
TETHER_TEST_WEBCAM_DEVICE (0.5.0) | tetherd test suite | Device 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.
| Variable | Values | Effect |
|---|---|---|
TETHER_MOCK_QUIET | any | No scripted pairing request or reply requests |
TETHER_MOCK_BT | off, unavailable, unpaired (default), paired, connected | Initial Bluetooth state |
TETHER_MOCK_FIRST_CALL | seconds (default 12) | Delay of the first fake incoming call |
TETHER_MOCK_ENHANCED | an enhanced state (default ready) | Initial state of the enhanced tier |
TETHER_MOCK_ADB | missing, too_old | State of adb |
TETHER_MOCK_APPS | empty, error | App list without apps, or an app list that fails to load |
TETHER_MOCK_AUDIO | unsupported, error, playback, playback_dup | Result of switching phone audio on |
TETHER_MOCK_ROTATE | seconds (default 9); 0 for never | Delay of the fake screen rotation |
TETHER_MOCK_WEBCAM_SETUP (0.5.0) | not_installed, not_loaded (default), no_device, ready, unsupported | Initial state of the virtual camera |
TETHER_MOCK_WEBCAM_SETUP_RESULT (0.5.0) | fail, cancel | Result of the set-up action |
TETHER_MOCK_WEBCAM (0.5.0) | unsupported, error, busy | Result of switching the webcam on |
TETHER_MOCK_CAMERAS (0.5.0) | number (default 2) | Number of fake cameras |