I've just lost my phone. I know it's here in my house cause I used it last night and my bluetooth speakers will connect to it this morning.
How can I text my phone using bash? Then the phone notification will sound and I can find my phone.
Note: I asked for a bash solution because it's simpler than installing and configuring a GUI. Also I am more comfortable working in bash than python, HTML, or java, etc. Finally a bash solution works in Windows 10 when you use the Windows Subsystem for Linux (WSL).
Note 2: Reply to comments:
- I don't have a landline so I can't simply call my smartphone.
- It was 6 am on Sunday morning when I lost my phone. People I could email to call my phone were sleeping. I was unsure of the battery charge level and if it died, I could never text it.
- A few weeks previously I had turned off email sound notifications on my smartphone so I couldn't email myself.
- I don't have
skype
or any VOIP service providers
After 30 minutes I did find the smartphone by texting it using the answer I posted below. It was hidden underneath 4" high-from-floor furniture shelf in the living-room...
SMS Texting from Terminal / Shell / Bash
For the following steps open a terminal prompt aka "Command Line Interface" or "CLI". In most Linux distributions do this using Ctrl+Alt+T
textbelt.com
to send text from bashI found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:
Replace
7801234567
with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.Note: The software replaces "Find Your Phone!" with a message that you need to purchase a key to use a custom message. But the software still insists you must provide a message that gets overwritten.
Other reasons for sending SMS Text Message from Bash
Finding my smartphone was an unusual need to send an SMS text message from Bash. You might have a few people that should be texted when:
textbelt.com
is Free for one text per dayOnly one free SMS message a day can be sent by a given sender. Here is an example of the first and second attempts on one day:
Note: You maybe able to reset your router's IP address for more than one text per day but I haven't tested this yet.
You can use prepaid unlimited texts. There are many SMS gateway services available. Pricing at above vendor link varies from $0.03 to $0.15 per text. This is for reference and not an endorsement nor recommendation. Please do your homework and search for reputable pay-for-service vendors at best prices.
Create Bash Script
You could create a bash script called
sms
containing:sms 7801234567 "Hello World"
Send Email to carrier of the smartphone with SMS Text Message
For the following all you need is a web browser like FireFox, Internet Explorer or Chrome. No need to dive into the "bowels of bash" or limit yourself to one free text per day.
Many carriers allow you to send SMS Text Message to a smartphone by addressing an email to
phone_number@mobile_provider_name.com
.Phone Number look up to get carrier's website address
To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number:
7801234567
:We are told the email address to use is
[email protected]
. Now send an email to this address and your phone will sound with a notification.Of course if you have your smartphone configured to sound with a notification when email arrives you can simply email your phone in the first place!
CLI interface for sending email address
In Ask Ubuntu there are many questions and answers on how to send email using bash. I'm using
ssmtp
(Secure Simple Mail Transport Protocol) for mycron
daily backups: Backup Linux configuration, scripts and documents to GmailAlthough this setup is for one user, you can create a file with multiple users to text messages to:
Then in your bash code something like this:
Where
mail.txt
looks like this:There are many ways of sending email from bash. This is just one example. The important thing is the email address contains the smartphone number followed by the smartphone provider's web address
This answer is not for command line as I can't find a command line solution for Google.
If you have an Android phone and don't want to use the command line, you can go to https://www.google.com/android/find in a web browser and ring your phone from there regardless of mute, vibrate or being connected to a Bluetooth headset. There is no extra software required on your phone either. This can also be done as many times as you want in a day.
Phone call from the browser, using Google Hangouts
You can also locate your phone by calling it, even if you don't have a landline.
Prerequisite: a Google account
Note: Only most calls to the US and Canada are free. See https://www.google.com/voice/b/0/rates?p=hangout for rates.