4

I have a script to toggle my screen backlight (mapped to a keyboard shortcut), and I want to save the brightness level so I can restore it when pressing the keyboard shortcut again.

Is there a standard place to save such files? Or should I just create some folder in my home directory to save them there?

I don't want to save them to /tmp because:

Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.

  • 4
    You can use /var/tmp. – jordanm Aug 5 '15 at 14:18
5

On Linux, /run or /var/run are the standard places for things that are not required to survive a reboot, but mustn't be removed by e.g. tmpreaper. Daemons generally keep their pid files in there, for instance.

If your script runs as an ordinary user, then a dot-directory in that user's home directory is probably the right choice. That's where applications with persistent settings (e.g. Firefox, GIMP, etc) keep their data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.