On Linux, you can save a screenshot of your currently focused window every X interval.

These are some of my screenshots, previewed with sxiv image viewer.

Why would you want to do so? So you have a high definition record of what you’re working on back then, so in the future you have a better contrast of how much you and your computing environment have changed over time.

For example, I can look back and pin point the exact day I switched to Vim from Typora as my main text editor. This puts things into perspective, the time certain things happened is no longer a vague memory that fades over time without recovery.

This can be achieved with 3 tools

  • the bash script below
  • scrot
  • cron

Install scrot

$ sudo apt-get install scrot

Save this bash script


#cd to script location
cd "$(dirname "$0")"

date_string=$(date --iso-8601=date)
mkdir -p ~/Pictures/cron_scrot_snapshot/$folderName

DISPLAY=:0 scrot -u ~/Pictures/cron_scrot_snapshot/$folderName/%Y-%m-%d_%H:%M:%S_scrot.png

This bash script creates a folder with the current date, in ISO8601 format (e.g. 2020-05-02) and saves the currently focused window into the date folder as a png file.

This is what the directory structure would look like.

Setting up a cronjob

You can set up a cronjob to run the script every X interval, for example every 5 minutes.

*/5 * * * * /path/to/script.sh