/dev/..... Where is the data in this directory being written to?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
/dev/..... Where is the data in this directory being written to?
Hi gang,
I am getting GPS up and running and need to get a log of all the locations visited in a moving vehicle.
I am puzzled by this command, which tells the GPS device to pipe all the location information it receives to a file in the /dev directory branch:
# gpsd -N -n -D 3 /dev/rfcomm0
When I enter "cat /dev/rfcomm0" i can see all this satellite data accumulating in an open terminal in one second intervals. What I don't understand is why the programmer is sending this data to a file in the /dev subdirectory. Is the data actually being saved there in the file rfcomm0 or is it basically just like a /dev/null situation where all data sent there is simply junked?
The files in "/dev" should all (or "mostly" ) be "pointers" to the actual kernel drivers for that particular device. They should NOT (for the most part ) be "files" like you find in the rest of the filesystem.
Files in the /dev directory are gateways to device drivers. If you do ls -l on them you will see that they have two numbers after their group. The first number is the index number of the device driver and the second has a meaning specific to that driver; their permissions begin with c or b indicating that the smallest unit of data transfer that can be made to the device is a character or a block.
Thus when you read from /dev/rfcomm0 you are getting data from the GPS device.
I think that file is a char device so it is a datastream for programmers. For a user that file is a FIFO buffer. All data get deleted on reading out.
Everything in linux is represented as a file also a complete harddisk - that's why you can grep a harddisk for deleted files.
Now I am only interested in lines starting with $GPRMC like this one above. But these only get spat out around one in 8 times. The other seven lines I don't need nor want. Is there any way in the C language I could write a utility which would check for this prefix in real time and only write these wanted lines to the file to be saved? I don't have much disk space remaining on the 8Gb SSHD notebook I'll be using.
Last edited by Completely Clueless; 08-21-2010 at 03:45 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.