User's Guide

From GnokiiWiki
Jump to: navigation, search
Command Line Options
User's Guide



If you can't find precompiled binaries for your system or if they aren't up to date see the installation page.


gnokii, smsd, xgnokii and gnocky can share the same configuration file. gnokii can read its configuration from any file while smsd, xgnokii and gnocky always search for the default configuration files; see Config for details on choosing the configuration and Config options for details on using it with gnokii.

To check your installation and configuration it is suggested that you run

gnokii --identify

If successful this will print some information about your phone. If this command fails then setting debug = on in the configuration and retrying might give the needed information for a bug report.


gnokii and smsd are typically run from a terminal window or a script.

xgnokii and gnocky are typically run from a menu or an icon but when run from a terminal they can print debug information.

Use cases

Phonebook backup and restore

# backup
gnokii --getphonebook ME 1 end --vcard >myphonebook.vcf
# restore
gnokii --writephonebook --vcard <myphonebook.vcf

Supported memory types vary between phones, "ME" means phone memory, see Memory_type_codes for details.

Supported output formats are --ldif, --vcard and --raw (which is a CSV format documented in man gnokii).

All these formats can be read back by gnokii, but the --ldif format doesn't store information about memory types and locations.

Restoring works better if destination phonebook is empty because phones behave differently when duplicates are found; see Phonebook options for details on the --overwrite and --find-free options.

Sources for a program which uses libgnokii to convert to and from any of those formats are available as phonebook_convert.c

SMS backup / exporting to file

Note that a true backup isn't possible because not all SMS fields are saved to file and there is no command to do a restore (some driver/phone combinations will allow to save an SMS to Inbox and/or to a custom folder using --savesms but format is different).

gnokii --getsms ME 1 end >mymessages.txt


gnokii --getsms ME 1 end --file mbox

Supported output formats are "human readable" (which is the default) or "mbox" (available since gnokii 0.6.20 using [-f|--file file] or [-F|--force-file file] or [-a|--append-file file]), which is also human readable but can be imported in many email programs for easier reading.
In all cases each part of a concatenated message is handled as a separate item.

Supported memory types vary between phones. See SMS options for details.

Handling calls

To dial a voice call:

gnokii --dialvoice 12345678

On success this command prints the callid parameter that can be used to hang up this call.

Note: to make a data call, eg. to send a fax or to connect to the Internet, do not use gnokii, just configure your system to use the phone as a modem.

To answer an incoming call:

gnokii --answercall callid

If you only have one incoming call, try 0 as the callid parameter.

To hang up:

gnokii --hangup callid

If you only have one active call, try 0 as the callid parameter.

See also Dialling and call options.

SMS Sending and Receiving

Use smsd if you need both to send and to receive SMS. You can use it with a file or a database backend.

If you only need to send, you can also use gnokii --sendsms, which reads message body from stdin.


echo "This is a test message" | gnokii --sendsms +12345678

See SMS options for details of --sendsms.

You can also use the utils/sendsms bash script that uses a text based interface using dialog as a more friendly frontend to gnokii --sendsms, allowing you to pick recipient numbers from your phonebooks instead of typing them on the command line.


To diagnose a problem and to send a bug report you need to enable debugging.

Setting debug = on in the configuration file will make libgnokii print to stderr all data exchanged with your phone and other details.

Setting xdebug = on will make xgnokii and smsd print to stderr more debug information.

Note that debug = on will print lower level details and xdebug = on will print higher level details.

Be sure to put all these variables into the [logging] section. See also troubleshooting and segfault.


After version 0.6.10 these changes were made to gnokii commandline invocation:

  • version 0.6.13 added --wappush option to --sendsms.
  • version 0.6.14 added --config and --phone options.
  • version 0.6.15 added the [end_number|end] argument to --writecalendarnote and --writetodo options.
  • version 0.6.25 added the ability to use --entersecuritycode with another gnokii command

Command Line Usage

GNOKII Version 0.6.32

		--config filename
		--phone phone_section

Use just one option at a time.
General options:
          --help [all] [monitor] [sms] [mms] [phonebook] [calendar] [todo]
                 [dial] [profile] [settings] [wap] [logo] [ringtone]
                 [security] [file] [other]
Monitoring options:
          --monitor [delay|once]
          --netmonitor {reset|off|field|devel|next|nr}
SMS options:
          --sendsms destination [--smsc message_center_number |
                 --smscno message_center_index] [-r|--report] [-8|--8bit]
                 [-C|--class n] [-v|--validity n]
                 [-i|--imelody] [-a|--animation file;file;file;file]
                 [-o|--concat this;total;serial] [-w|--wappush url]
          --savesms [--sender from] [--smsc message_center_number |
                 --smscno message_center_index] [-f|--folder folder_id]
                 [-l|--location number] [-s|--sent|-r|--read] [-d|--deliver]
                 [-t|--datetime YYMMDDHHMMSS]
          --getsms memory_type start [end] [-f|--file file]
                 [-F|--force-file file] [-a|--append-file file]
          --deletesms memory_type start [end]
          --getsmsc [start_number [end_number]] [-r|--raw]
          --createsmsfolder name
          --deletesmsfolder folderid
MMS options:
          --getmms memory_type start [end] [{--mime|--pdu|--raw} file]
                 [-d|--delete] [-o|--overwrite]
          --deletemms memory_type start [end]
Phonebook options:
          --getphonebook memory_type start_number [end_number|end]
          --writephonebook [[-o|--overwrite]|[-f|--find-free]]
                 [-m|--memory-type|--memory memory_type]
                 [-n|--memory-location|--location number]
          --deletephonebook memory_type start_number [end_number|end]
Calendar options:
          --getcalendarnote start_number [end_number|end] [-v|--vCal]
          --writecalendarnote vcalendarfile start_number [end_number|end]
          --deletecalendarnote start [end_number|end]
ToDo options:
          --gettodo start_number [end_number|end] [-v|--vCal]
          --writetodo vcalendarfile start_number [end_number|end]
Dialling and call options:
          --getspeeddial location
          --setspeeddial number memory_type location
          --dialvoice number
          --senddtmf string
          --answercall callid
          --hangup callid
          --divert {--op|-o} {register|enable|query|disable|erasure}
                 {--type|-t} {all|busy|noans|outofreach|notavail}
                 {--call|-c} {all|voice|fax|data}
                 [{--timeout|-m} time_in_seconds]
                 [{--number|-n} number]
All number, location and callid options need to be numeric.
Profile options:
          --getprofile [start_number [end_number]] [-r|--raw]
          --setactiveprofile profile_number
Phone settings:
          --reset [soft|hard]
          --setdatetime [YYYY [MM [DD [HH [MM]]]]]
          --setalarm [HH MM]
WAP options:
          --getwapbookmark number
          --writewapbookmark name URL
          --deletewapbookmark number
          --getwapsetting number [-r|--raw]
          --activatewapsetting number
Logo options:
          --sendlogo {caller|op|picture} destination logofile
          --setlogo op [logofile [network_code]]
          --setlogo startup [logofile]
          --setlogo caller [logofile [caller_group_number [group_name]]]
          --setlogo {dealer|text} [text]
          --getlogo op [logofile [network_code]]
          --getlogo startup [logofile [network_code]]
          --getlogo caller [caller_group_number [logofile
          --getlogo {dealer|text}
          --viewlogo logofile
Ringtone options:
          --sendringtone rtttlfile destination
          --getringtone rtttlfile [location] [-r|--raw]
          --setringtone rtttlfile [location] [-r|--raw] [--name name]
          --playringtone rtttlfile [--volume vol]
          --ringtoneconvert source destination
          --deleteringtone start [end]
Security options:
          --entersecuritycode PIN|PIN2|PUK|PUK2|SEC [COMMAND]
          --changesecuritycode PIN|PIN2|PUK|PUK2
File options:
          --getfilelist remote_path
          --getfiledetailsbyid [id]
          --getfileid remote_filename
          --getfile remote_filename [local_filename]
          --getfilebyid id [local_filename]
          --getallfiles remote_path
          --putfile local_filename remote_filename
          --deletefile remote_filename
          --deletefilebyid id
Misc options: