I am repeatedly executing the ls -l command within /tmp/stream and I receive the following output:
pi@dewsaq18 /tmp/stream $ ls -l
total 112
-rw-r--r-- 1 pi pi 112812 Feb 7 03:32 pic.jpg
pi@dewsaq18 /tmp/stream $ ls -l
total 112
-rw-r--r-- 1 pi pi 112812 Feb 7 03:32 pic.jpg
-rw-r--r-- 1 pi pi 0 Feb 7 03:32 pic.jpg~
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 116748 Feb 7 03:32 pic.jpg
-rw-r--r-- 1 pi pi 0 Feb 7 03:32 pic.jpg~
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 117608 Feb 7 03:32 pic.jpg
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 117608 Feb 7 03:32 pic.jpg
-rw-r--r-- 1 pi pi 0 Feb 7 03:32 pic.jpg~
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 118674 Feb 7 03:32 pic.jpg
-rw-r--r-- 1 pi pi 0 Feb 7 03:32 pic.jpg~
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 118147 Feb 7 03:32 pic.jpg
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 118147 Feb 7 03:32 pic.jpg
-rw-r--r-- 1 pi pi 0 Feb 7 03:32 pic.jpg~
pi@dewsaq18 /tmp/stream $ ls -l
total 116
-rw-r--r-- 1 pi pi 117175 Feb 7 03:32 pic.jpg
pi@dewsaq18 /tmp/stream $
......and so on
My question is - what exactly is going on with the "~" character appended to the second (empty) file? Why doesn't this file show up each time ls -l is executed?
Since I'm using a static filename pic.jpg and the image is overwritten each time a new one is taken, my initial thought was the pic.jpg~ file's use was to compare changes between frames.
However, it isn't always there (maybe there were no changes, so it is not needed?) and, even more so, it is always empty without any data written to it at all.
Thanks for the help and direction in advance.
The tilde (~) at the end of a file name is often used to signify a backup file. So if you have a file foo.bar and you edit it and save it, the new saved file would be foo.bar and the previous version would be foo.bar~. But it's program dependent: not all editors or programs would save the prior version of a file as a backup, and if they do, they don't all follow the convention of appending a tilde (~). It's not literally a standard, but rather a very commonly used convention.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With