How can I text my phone from Bash?












35














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...










share|improve this question




















  • 8




    Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
    – terdon
    2 days ago








  • 1




    @terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
    – WinEunuuchs2Unix
    2 days ago












  • You can also call it using Skype or any other voip client.
    – terdon
    2 days ago










  • I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
    – terdon
    2 days ago






  • 1




    There is no software to install on the Android one. You just go to google.com/android/find
    – Terrance
    2 days ago
















35














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...










share|improve this question




















  • 8




    Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
    – terdon
    2 days ago








  • 1




    @terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
    – WinEunuuchs2Unix
    2 days ago












  • You can also call it using Skype or any other voip client.
    – terdon
    2 days ago










  • I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
    – terdon
    2 days ago






  • 1




    There is no software to install on the Android one. You just go to google.com/android/find
    – Terrance
    2 days ago














35












35








35


13





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...










share|improve this question















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...







command-line bash windows-subsystem-for-linux sms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday

























asked 2 days ago









WinEunuuchs2Unix

42.9k1075163




42.9k1075163








  • 8




    Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
    – terdon
    2 days ago








  • 1




    @terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
    – WinEunuuchs2Unix
    2 days ago












  • You can also call it using Skype or any other voip client.
    – terdon
    2 days ago










  • I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
    – terdon
    2 days ago






  • 1




    There is no software to install on the Android one. You just go to google.com/android/find
    – Terrance
    2 days ago














  • 8




    Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
    – terdon
    2 days ago








  • 1




    @terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
    – WinEunuuchs2Unix
    2 days ago












  • You can also call it using Skype or any other voip client.
    – terdon
    2 days ago










  • I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
    – terdon
    2 days ago






  • 1




    There is no software to install on the Android one. You just go to google.com/android/find
    – Terrance
    2 days ago








8




8




Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
– terdon
2 days ago






Why don't you just call it from a land line or a friend's phone? Or send an email if it's a smartphone?
– terdon
2 days ago






1




1




@terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
– WinEunuuchs2Unix
2 days ago






@terdon I don't have a landline. I wanted to email a friend and have her call my phone but she can sleep in to 2pm on Sundays. It was 6 am and I was desperate to find my phone. I had turned off sound alerts for email otherwise I could have also emailed my phone. Your two questions constitute an answer though that would work well for many other users.
– WinEunuuchs2Unix
2 days ago














You can also call it using Skype or any other voip client.
– terdon
2 days ago




You can also call it using Skype or any other voip client.
– terdon
2 days ago












I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
– terdon
2 days ago




I'm posting comments because I think they disqualify the question, rather than answering it. I would instead suggest you add these specific requirements to your question to avoid having these obvious but impractical for you answers.
– terdon
2 days ago




1




1




There is no software to install on the Android one. You just go to google.com/android/find
– Terrance
2 days ago




There is no software to install on the Android one. You just go to google.com/android/find
– Terrance
2 days ago










4 Answers
4






active

oldest

votes


















30
















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 bash



I found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:



curl -X POST https://textbelt.com/text 
--data-urlencode phone='7801234567'
--data-urlencode message='Find Your Phone!'
-d key=textbelt


Replace 7801234567 with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.





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:




  • Disks are about to fail (or other hardware errors occurred)

  • Disk space utilization exceeds threshold, for example 90%

  • RAM is full and swap is being used heavily

  • Web server is experiencing external attacks

  • A user had too many invalid sign-ons and account is deactivated

  • A specific job has been run which effects key processes

  • A door badge reader monitors a certain door being unlocked





textbelt.com is Free for one text per day



Only 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:



$ find-phone # bash script with above command
{"success":true,"textId":"168141545572031481","quotaRemaining":0}

$ find-phone
{"success":false,"error":"Only one test text message is allowed per day.","quotaRemaining":0}


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:



#!/bin/bash
curl -X POST https://textbelt.com/text --data-urlencode phone='$1' --data-urlencode message='$2' -d key=textbelt



  • Send SMS message using sms 7801234567 "Hello World"

  • Thank you Fabby for testing this from the EU and confirming it works there.




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.



Most if not all carriers allow you to send SMS Text Message to a smartphone by addressing an email to phone_number@mobile_provider_name.com.



To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number: 7801234567:



Fee Carrier Lookup.png



We are told the email address to use is 7801234567@pcs.rogers.com. 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!






share|improve this answer



















  • 12




    There are also email addresses you can send to that the phone company will forward to your phone as a text.
    – Kevin
    2 days ago










  • I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
    – Kevin
    2 days ago










  • @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
    – sudodus
    2 days ago






  • 1




    Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
    – sudodus
    2 days ago








  • 1




    I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
    – PerlDuck
    yesterday



















18














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.






share|improve this answer































    4














    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.




    1. Go to hangouts.google.com

    2. Click the "Phone call" button:
      button screenshot

    3. Click "New conversation":
      button screenshot

    4. Enter your phone number:
      number entry box screenshot

    5. Click "Call":
      call button screenshot






    share|improve this answer























    • I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
      – WinEunuuchs2Unix
      yesterday










    • Does not work in my country without money on their account.
      – sudodus
      21 hours ago






    • 1




      @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
      – Nonny Moose
      21 hours ago










    • @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
      – WinEunuuchs2Unix
      20 hours ago



















    0














    The way I did it years ago was to have fun with python and learn the language.



    What I did was:




    • Write some python code that uses the smtp module

    • Test it with Gmail

    • Figure out the email address that maps to my phone number (looked up the three big carriers' email to text APIs (really they are just an email domain where the user is the phone number))

    • create a command line tool

    • test with my phone number


    And VOILA! texting from bash.



    P.s. written from a hard to use mobile device... If this gains more attention I could look into finding the old code






    share|improve this answer

















    • 3




      I think that python isn't required part here, use unix mail utils to send message.
      – val
      yesterday






    • 1




      I think this is more of an overview to an answer and the important steps / commands need to follow.
      – WinEunuuchs2Unix
      yesterday






    • 1




      @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
      – Trevor Boyd Smith
      yesterday











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104017%2fhow-can-i-text-my-phone-from-bash%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    30
















    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 bash



    I found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:



    curl -X POST https://textbelt.com/text 
    --data-urlencode phone='7801234567'
    --data-urlencode message='Find Your Phone!'
    -d key=textbelt


    Replace 7801234567 with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.





    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:




    • Disks are about to fail (or other hardware errors occurred)

    • Disk space utilization exceeds threshold, for example 90%

    • RAM is full and swap is being used heavily

    • Web server is experiencing external attacks

    • A user had too many invalid sign-ons and account is deactivated

    • A specific job has been run which effects key processes

    • A door badge reader monitors a certain door being unlocked





    textbelt.com is Free for one text per day



    Only 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:



    $ find-phone # bash script with above command
    {"success":true,"textId":"168141545572031481","quotaRemaining":0}

    $ find-phone
    {"success":false,"error":"Only one test text message is allowed per day.","quotaRemaining":0}


    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:



    #!/bin/bash
    curl -X POST https://textbelt.com/text --data-urlencode phone='$1' --data-urlencode message='$2' -d key=textbelt



    • Send SMS message using sms 7801234567 "Hello World"

    • Thank you Fabby for testing this from the EU and confirming it works there.




    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.



    Most if not all carriers allow you to send SMS Text Message to a smartphone by addressing an email to phone_number@mobile_provider_name.com.



    To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number: 7801234567:



    Fee Carrier Lookup.png



    We are told the email address to use is 7801234567@pcs.rogers.com. 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!






    share|improve this answer



















    • 12




      There are also email addresses you can send to that the phone company will forward to your phone as a text.
      – Kevin
      2 days ago










    • I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
      – Kevin
      2 days ago










    • @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
      – sudodus
      2 days ago






    • 1




      Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
      – sudodus
      2 days ago








    • 1




      I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
      – PerlDuck
      yesterday
















    30
















    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 bash



    I found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:



    curl -X POST https://textbelt.com/text 
    --data-urlencode phone='7801234567'
    --data-urlencode message='Find Your Phone!'
    -d key=textbelt


    Replace 7801234567 with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.





    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:




    • Disks are about to fail (or other hardware errors occurred)

    • Disk space utilization exceeds threshold, for example 90%

    • RAM is full and swap is being used heavily

    • Web server is experiencing external attacks

    • A user had too many invalid sign-ons and account is deactivated

    • A specific job has been run which effects key processes

    • A door badge reader monitors a certain door being unlocked





    textbelt.com is Free for one text per day



    Only 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:



    $ find-phone # bash script with above command
    {"success":true,"textId":"168141545572031481","quotaRemaining":0}

    $ find-phone
    {"success":false,"error":"Only one test text message is allowed per day.","quotaRemaining":0}


    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:



    #!/bin/bash
    curl -X POST https://textbelt.com/text --data-urlencode phone='$1' --data-urlencode message='$2' -d key=textbelt



    • Send SMS message using sms 7801234567 "Hello World"

    • Thank you Fabby for testing this from the EU and confirming it works there.




    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.



    Most if not all carriers allow you to send SMS Text Message to a smartphone by addressing an email to phone_number@mobile_provider_name.com.



    To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number: 7801234567:



    Fee Carrier Lookup.png



    We are told the email address to use is 7801234567@pcs.rogers.com. 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!






    share|improve this answer



















    • 12




      There are also email addresses you can send to that the phone company will forward to your phone as a text.
      – Kevin
      2 days ago










    • I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
      – Kevin
      2 days ago










    • @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
      – sudodus
      2 days ago






    • 1




      Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
      – sudodus
      2 days ago








    • 1




      I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
      – PerlDuck
      yesterday














    30












    30








    30








    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 bash



    I found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:



    curl -X POST https://textbelt.com/text 
    --data-urlencode phone='7801234567'
    --data-urlencode message='Find Your Phone!'
    -d key=textbelt


    Replace 7801234567 with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.





    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:




    • Disks are about to fail (or other hardware errors occurred)

    • Disk space utilization exceeds threshold, for example 90%

    • RAM is full and swap is being used heavily

    • Web server is experiencing external attacks

    • A user had too many invalid sign-ons and account is deactivated

    • A specific job has been run which effects key processes

    • A door badge reader monitors a certain door being unlocked





    textbelt.com is Free for one text per day



    Only 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:



    $ find-phone # bash script with above command
    {"success":true,"textId":"168141545572031481","quotaRemaining":0}

    $ find-phone
    {"success":false,"error":"Only one test text message is allowed per day.","quotaRemaining":0}


    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:



    #!/bin/bash
    curl -X POST https://textbelt.com/text --data-urlencode phone='$1' --data-urlencode message='$2' -d key=textbelt



    • Send SMS message using sms 7801234567 "Hello World"

    • Thank you Fabby for testing this from the EU and confirming it works there.




    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.



    Most if not all carriers allow you to send SMS Text Message to a smartphone by addressing an email to phone_number@mobile_provider_name.com.



    To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number: 7801234567:



    Fee Carrier Lookup.png



    We are told the email address to use is 7801234567@pcs.rogers.com. 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!






    share|improve this answer
















    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 bash



    I found a reddit article: Send an SMS Text Message from the Command Line with this Bash / Terminal command you can use:



    curl -X POST https://textbelt.com/text 
    --data-urlencode phone='7801234567'
    --data-urlencode message='Find Your Phone!'
    -d key=textbelt


    Replace 7801234567 with your phone number. If you are texting an international phone number (outside Canada / USA) follow these instructions.





    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:




    • Disks are about to fail (or other hardware errors occurred)

    • Disk space utilization exceeds threshold, for example 90%

    • RAM is full and swap is being used heavily

    • Web server is experiencing external attacks

    • A user had too many invalid sign-ons and account is deactivated

    • A specific job has been run which effects key processes

    • A door badge reader monitors a certain door being unlocked





    textbelt.com is Free for one text per day



    Only 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:



    $ find-phone # bash script with above command
    {"success":true,"textId":"168141545572031481","quotaRemaining":0}

    $ find-phone
    {"success":false,"error":"Only one test text message is allowed per day.","quotaRemaining":0}


    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:



    #!/bin/bash
    curl -X POST https://textbelt.com/text --data-urlencode phone='$1' --data-urlencode message='$2' -d key=textbelt



    • Send SMS message using sms 7801234567 "Hello World"

    • Thank you Fabby for testing this from the EU and confirming it works there.




    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.



    Most if not all carriers allow you to send SMS Text Message to a smartphone by addressing an email to phone_number@mobile_provider_name.com.



    To get the provider's website address using the phone number go to: https://freecarrierlookup.com/. Imagine we entered the phone number: 7801234567:



    Fee Carrier Lookup.png



    We are told the email address to use is 7801234567@pcs.rogers.com. 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!







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 19 hours ago

























    answered 2 days ago









    WinEunuuchs2Unix

    42.9k1075163




    42.9k1075163








    • 12




      There are also email addresses you can send to that the phone company will forward to your phone as a text.
      – Kevin
      2 days ago










    • I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
      – Kevin
      2 days ago










    • @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
      – sudodus
      2 days ago






    • 1




      Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
      – sudodus
      2 days ago








    • 1




      I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
      – PerlDuck
      yesterday














    • 12




      There are also email addresses you can send to that the phone company will forward to your phone as a text.
      – Kevin
      2 days ago










    • I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
      – Kevin
      2 days ago










    • @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
      – sudodus
      2 days ago






    • 1




      Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
      – sudodus
      2 days ago








    • 1




      I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
      – PerlDuck
      yesterday








    12




    12




    There are also email addresses you can send to that the phone company will forward to your phone as a text.
    – Kevin
    2 days ago




    There are also email addresses you can send to that the phone company will forward to your phone as a text.
    – Kevin
    2 days ago












    I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
    – Kevin
    2 days ago




    I won’t be at a computer to test for 12+ hours, but I’ve definitely sent emails from the command line before. It may take some configuration (username/password) to get it working for gmail specifically though.
    – Kevin
    2 days ago












    @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
    – sudodus
    2 days ago




    @Kevin, It is also a good idea to send an SMS from gmail in order to find a phone, even if it is via a graphical user interface (and a graphical desktop environment).
    – sudodus
    2 days ago




    1




    1




    Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
    – sudodus
    2 days ago






    Skype can send an SMS or a regular voice phone-call (which will make the phone make sounds for a longer time). It costs money, but not too much. Maybe they won't charge for a phone-call, it you don't answer (after finding the phone) ;-)
    – sudodus
    2 days ago






    1




    1




    I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
    – PerlDuck
    yesterday




    I know it's beyond the scope of this Q&A but for sending alerts for full disks/RAM or any other failures to dedicated users I would not rely on a service that sends SMS once a day but attach a modem with a SIM card instead. In Germany (Europe?) the CEP CT63 is quite popular.
    – PerlDuck
    yesterday













    18














    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.






    share|improve this answer




























      18














      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.






      share|improve this answer


























        18












        18








        18






        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.






        share|improve this answer














        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.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered 2 days ago









        Terrance

        18.8k34295




        18.8k34295























            4














            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.




            1. Go to hangouts.google.com

            2. Click the "Phone call" button:
              button screenshot

            3. Click "New conversation":
              button screenshot

            4. Enter your phone number:
              number entry box screenshot

            5. Click "Call":
              call button screenshot






            share|improve this answer























            • I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
              – WinEunuuchs2Unix
              yesterday










            • Does not work in my country without money on their account.
              – sudodus
              21 hours ago






            • 1




              @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
              – Nonny Moose
              21 hours ago










            • @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
              – WinEunuuchs2Unix
              20 hours ago
















            4














            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.




            1. Go to hangouts.google.com

            2. Click the "Phone call" button:
              button screenshot

            3. Click "New conversation":
              button screenshot

            4. Enter your phone number:
              number entry box screenshot

            5. Click "Call":
              call button screenshot






            share|improve this answer























            • I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
              – WinEunuuchs2Unix
              yesterday










            • Does not work in my country without money on their account.
              – sudodus
              21 hours ago






            • 1




              @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
              – Nonny Moose
              21 hours ago










            • @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
              – WinEunuuchs2Unix
              20 hours ago














            4












            4








            4






            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.




            1. Go to hangouts.google.com

            2. Click the "Phone call" button:
              button screenshot

            3. Click "New conversation":
              button screenshot

            4. Enter your phone number:
              number entry box screenshot

            5. Click "Call":
              call button screenshot






            share|improve this answer














            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.




            1. Go to hangouts.google.com

            2. Click the "Phone call" button:
              button screenshot

            3. Click "New conversation":
              button screenshot

            4. Enter your phone number:
              number entry box screenshot

            5. Click "Call":
              call button screenshot







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 21 hours ago

























            answered yesterday









            Nonny Moose

            884621




            884621












            • I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
              – WinEunuuchs2Unix
              yesterday










            • Does not work in my country without money on their account.
              – sudodus
              21 hours ago






            • 1




              @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
              – Nonny Moose
              21 hours ago










            • @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
              – WinEunuuchs2Unix
              20 hours ago


















            • I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
              – WinEunuuchs2Unix
              yesterday










            • Does not work in my country without money on their account.
              – sudodus
              21 hours ago






            • 1




              @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
              – Nonny Moose
              21 hours ago










            • @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
              – WinEunuuchs2Unix
              20 hours ago
















            I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
            – WinEunuuchs2Unix
            yesterday




            I see $0.00 next to the phone number to call. Can you elaborate on cost to use this service?
            – WinEunuuchs2Unix
            yesterday












            Does not work in my country without money on their account.
            – sudodus
            21 hours ago




            Does not work in my country without money on their account.
            – sudodus
            21 hours ago




            1




            1




            @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
            – Nonny Moose
            21 hours ago




            @WinEunuuchs2Unix So sorry! I forgot that Google Hangouts charges for calls outside of the US and Canada. I've updated my answer accordingly.
            – Nonny Moose
            21 hours ago












            @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
            – WinEunuuchs2Unix
            20 hours ago




            @NonnyMoose Thanks for updating. I already upvoted your answer before my comment.
            – WinEunuuchs2Unix
            20 hours ago











            0














            The way I did it years ago was to have fun with python and learn the language.



            What I did was:




            • Write some python code that uses the smtp module

            • Test it with Gmail

            • Figure out the email address that maps to my phone number (looked up the three big carriers' email to text APIs (really they are just an email domain where the user is the phone number))

            • create a command line tool

            • test with my phone number


            And VOILA! texting from bash.



            P.s. written from a hard to use mobile device... If this gains more attention I could look into finding the old code






            share|improve this answer

















            • 3




              I think that python isn't required part here, use unix mail utils to send message.
              – val
              yesterday






            • 1




              I think this is more of an overview to an answer and the important steps / commands need to follow.
              – WinEunuuchs2Unix
              yesterday






            • 1




              @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
              – Trevor Boyd Smith
              yesterday
















            0














            The way I did it years ago was to have fun with python and learn the language.



            What I did was:




            • Write some python code that uses the smtp module

            • Test it with Gmail

            • Figure out the email address that maps to my phone number (looked up the three big carriers' email to text APIs (really they are just an email domain where the user is the phone number))

            • create a command line tool

            • test with my phone number


            And VOILA! texting from bash.



            P.s. written from a hard to use mobile device... If this gains more attention I could look into finding the old code






            share|improve this answer

















            • 3




              I think that python isn't required part here, use unix mail utils to send message.
              – val
              yesterday






            • 1




              I think this is more of an overview to an answer and the important steps / commands need to follow.
              – WinEunuuchs2Unix
              yesterday






            • 1




              @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
              – Trevor Boyd Smith
              yesterday














            0












            0








            0






            The way I did it years ago was to have fun with python and learn the language.



            What I did was:




            • Write some python code that uses the smtp module

            • Test it with Gmail

            • Figure out the email address that maps to my phone number (looked up the three big carriers' email to text APIs (really they are just an email domain where the user is the phone number))

            • create a command line tool

            • test with my phone number


            And VOILA! texting from bash.



            P.s. written from a hard to use mobile device... If this gains more attention I could look into finding the old code






            share|improve this answer












            The way I did it years ago was to have fun with python and learn the language.



            What I did was:




            • Write some python code that uses the smtp module

            • Test it with Gmail

            • Figure out the email address that maps to my phone number (looked up the three big carriers' email to text APIs (really they are just an email domain where the user is the phone number))

            • create a command line tool

            • test with my phone number


            And VOILA! texting from bash.



            P.s. written from a hard to use mobile device... If this gains more attention I could look into finding the old code







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 days ago









            Trevor Boyd Smith

            231111




            231111








            • 3




              I think that python isn't required part here, use unix mail utils to send message.
              – val
              yesterday






            • 1




              I think this is more of an overview to an answer and the important steps / commands need to follow.
              – WinEunuuchs2Unix
              yesterday






            • 1




              @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
              – Trevor Boyd Smith
              yesterday














            • 3




              I think that python isn't required part here, use unix mail utils to send message.
              – val
              yesterday






            • 1




              I think this is more of an overview to an answer and the important steps / commands need to follow.
              – WinEunuuchs2Unix
              yesterday






            • 1




              @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
              – Trevor Boyd Smith
              yesterday








            3




            3




            I think that python isn't required part here, use unix mail utils to send message.
            – val
            yesterday




            I think that python isn't required part here, use unix mail utils to send message.
            – val
            yesterday




            1




            1




            I think this is more of an overview to an answer and the important steps / commands need to follow.
            – WinEunuuchs2Unix
            yesterday




            I think this is more of an overview to an answer and the important steps / commands need to follow.
            – WinEunuuchs2Unix
            yesterday




            1




            1




            @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
            – Trevor Boyd Smith
            yesterday




            @val using mail instead of writing python code with smtp sounds like you might get a little easier and faster solution. Just do a simple bash shell script that would be less than Thursday lines.
            – Trevor Boyd Smith
            yesterday


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104017%2fhow-can-i-text-my-phone-from-bash%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Trompette piccolo

            Slow SSRS Report in dynamic grouping and multiple parameters

            Simon Yates (cyclisme)