Web sticks or Internet sticks are USB devices to connect a notebook to the internet if there is no wireless available. With the driver there comes typically a GUI where one can connect the network and send SMS too. Here I describe how to send a SMS from the command line. My environment

  • MacBook Pro with macOS Sierra version 10.12.1
  • Web Stick from T-Mobile, actually hardware is from Huawei Technologies Co., Ltd - Version 1.02

But it should work with any Linux like operating system very similar. If you connect such a web stick you will find additional entries in “/dev”. In my case it looks like this:

crw-rw-rw-   1 root   wheel           20,   2 Nov 19 13:54 tty.HUAWEIMobile-Modem
crw-rw-rw-   1 root   wheel           20,   3 Nov 19 13:54 cu.HUAWEIMobile-Modem
crw-rw-rw-   1 root   wheel           20,   6 Nov 19 13:54 tty.HUAWEIMobile-Pcui
crw-rw-rw-   1 root   wheel           20,   4 Nov 19 13:54 tty.HUAWEIMobile-Diag
crw-rw-rw-   1 root   wheel           20,   7 Nov 19 13:54 cu.HUAWEIMobile-Pcui
crw-rw-rw-   1 root   wheel           20,   5 Nov 19 13:54 cu.HUAWEIMobile-Diag

Now we can connect to the device. We do this either with “screen” command or with “cu” command:

screen  /dev/tty.HUAWEIMobile-Modem 115200 8N1

or

sudo cu -l  /dev/cu.HUAWEIMobile-Modem -s 115200

Such a device does typically not echo characters from input. Therefore we type in

at e1

for easier communication in the future. Now we should see an “OK”. And if wee press any key we will see it on the screen.

Maybe you have to set the GSM modem to text mode SMS

AT +CMGF=1
OK

Probably you have to authenticate with a PIN. PIN and PUK are delivered by the Internet service provider.

AT+CPIN=1234
OK

Now we are able to send a SMS. End of text is done by pressing “ctrl” + z. I symbolized this with the string ctrl-z.

AT+CMGS="0123456789"
> hello world
> ctrl-z
+CMGS: 9

OK

Within some seconds the owner of the phone with number 0123456789 should receive a SMS with text “hello world”.

To quit the session press ctrl-a k within the screen session or ~. within cu.

If you want to run a SMS gateway permanently for receiving and sending SMS from your Linux box you should search for SMS Server Tools 3. Home page is http://smstools3.kekekasvi.com/