The following will work in OSX will probably work in a similar form in linux.
Go to bluetooth preferences and select your phone and click Edit Serial Ports, add a new RS232 serial port, if there isnt one listed, I called mine Nokia. It can then be found under /dev/cu.Nokia.
Run in one terminal:
echo -e “at+creg=2\r\n” > /dev/cu.Nokia # sends at command to enable retrieval of cell id, fails on a lot of phones I’ve tried, works on the nokia n73 though.
while [[ 0 ]];
echo -e “at+creg?\r\n” > /dev/cu.Nokia; # causes the phone to output its cellid & location area code
sleep 1; # you dont want to be sending data all the time 🙂
In another terminal do:
dd if=/dev/Nokia bs=1 # this will retrieve the cell ids found
or to log the cell towers to a file,
dd if=/dev/Nokia of= ~/cells bs=1 # this will retrieve the cell ids found
cat ~/cells | uniq > ~/cell-list # gets rid of duplicate entries of cell towers