Skip to content

kdeconnect-cli

Command-line client for KDE Connect (pair devices, send files, ping, SMS, clipboard, notifications)


List all devices

kdeconnect-cli --list-devices

Display this device's id and exit

kdeconnect-cli --my-id

Device ID

kdeconnect-cli -a --id-only

Device Name

kdeconnect-cli -a --name-only

Print KDE Connect id and device name

kdeconnect-cli -a --id-name-only | awk '{$1=""; sub(/^ /,""); print}'
kdeconnect-cli -a --id-name-only | awk '{print substr($0, index($0, $2))}'
kdeconnect-cli -l 2>/dev/null | awk '/^- / { sub(/^- /,""); sub(/:.*/,""); print; exit }' # Slowest

Extract KDE Connect device ID (script-safe)

kdeconnect-cli -a  --id-name-only|awk '{print $1}'
kdeconnect-cli -l 2>/dev/null | awk '/^- / { sub(/^.*: /,""); print $1; exit }'

Request pairing with a specifik device by ID

kdeconnect-cli --pair --device --name $(kdeconnect-cli -a  --name-only)

List available (paired and reachable) devices

kdeconnect-cli -a

List all backends and status

kdeconnect-cli -b

Enable the specified backend

backend="$(kdeconnect-cli -b)"
kdeconnect-cli --enable-backend $backend

Disable the specified backend

backend="$(kdeconnect-cli -b)"
kdeconnect-cli --disable-backend $backend

Make –list-devices or –list-available print only the devices id, to ease scripting

kdeconnect-cli -a --id-only 

Make –list-devices or –list-available print only the devices name, to ease scripting

kdeconnect-cli --name-only

Make --list-devices or --list-available print only the devices id and name, to ease scripting

kdeconnect-cli -a  --id-name-only

Search for devices in the network and re-establish connections

kdeconnect-cli --refresh

Request pairing to a said device

device_id="$(kdeconnect-cli -a  --id-name-only|awk '{print $1}')"
kdeconnect-cli --pair -d $device_id

Find the device by ringing it

kdeconnect-cli --ring --name "$(kdeconnect-cli -l 2>/dev/null | awk '/^- / { sub(/^- /,""); sub(/:.*/,""); print; exit }')"

Find the said device by ringing it.

device_name="$(kdeconnect-cli -l 2>/dev/null | awk '/^- / { sub(/^- /,""); sub(/:.*/,""); print; exit }')"
set -x
kdeconnect-cli --ring --name "$device_name"
set +x

Stop pairing to a said device

kdeconnect-cli --unpair

Sends a ping notification with "Hello" in statusbar to said device

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "Hello"

Same as ping but you can set the message to display

kdeconnect-cli --ping-msg <message>

Sends the current clipboard to said device

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --send-clipboard 

Simulate a key press on a specifik device

kdeconnect-cli --name $(kdeconnect-cli -a --name-only) --send-keys {{key}}

Share a file/URL to a said device

kdeconnect-cli --share "<path or URL or text>" -d $(kdeconnect-cli -a --id-only)

Share text to clipboard on device

kdeconnect-cli --share-text "hey" -d $(kdeconnect-cli -a --id-only)

Display the notifications on a said device

kdeconnect-cli --list-notifications -d $(kdeconnect-cli -a --id-only)

Lock the specified device

kdeconnect-cli --lock -d $(kdeconnect-cli -a --id-only)

Unlock the specified device

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --unlock

Sends an SMS. Requires destination

kdeconnect-cli --send-sms "test message" --destination +46xxxxxxx -d $(kdeconnect-cli -a --id-only)

Send an SMS with an attachment

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --send-sms "https://www.linux-shell.se" --destination +46727777681

File URLs to send attachments with the message (can be passed multiple times)

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --attachment <attachment>

Get encryption info about said device

kdeconnect-cli --encryption-info -d $(kdeconnect-cli --my-id)

Lists remote commands and their ids

kdeconnect-cli --list-commands

Executes a remote command by id

kdeconnect-cli --execute-command <id>

Sends keys to a said device

kdeconnect-cli -k <key>

Mount filesystem of a said device

kdeconnect-cli --mount -d $(kdeconnect-cli -a --id-only) 
df -T

Print mount point for the filesystem of a said device

kdeconnect-cli --get-mount-point -d "$(kdeconnect-cli -a --id-only)"

Displays version information.

kdeconnect-cli -v

Show author information.

kdeconnect-cli --author

Show license information.

kdeconnect-cli --license

The base file name of the desktop entry for this application.

kdeconnect-cli --desktopfile <file name>

Send a file to the first reachable KDE Connect device (one-liner)

kdeconnect-cli -d "$(kdeconnect-cli -a --id-only)" --share kdeconnect-cli-send-file.sh

Share an URL or file with a paired device, specifying its ID

kdeconnect-cli --share "https://www.linux-shell.se" -d $(kdeconnect-cli -a --id-only)

Send the status of baloo indexing

kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(konsole --help)"