Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Gnome-screenshot 3.1.2 uses filenames like this one

Screenshot at 2011-07-31 12:13:04.png

making it rather easy to see when it was taken.

The problem is that it uses the colon ( : ) character - making it impossible to access such an image from Windows.

Considering I take most of my screenshots so I can send them to Windows users this has caused some problems.

Is there any way to change the default name that is used by the screenshot tool to replace the ":" with "." or "," ?

share|improve this question

It is not actually possible change it easily, maybe you can help with this bug report.

(for the curious, check the source code. Currently, relevant line is 134)

Update: The bug was fixed upstream on 2015-01-28, replacing colons with dashes, which helps. But they didn't take the space out unfortunately.

share|improve this answer
+1 for linking to source code. Now THAT is the linux way. (Although the file name code is actually here, now:…) – mehaase Jul 16 '12 at 19:35
Unfortunately, the link is dead: No repositories found – gertvdijk Feb 4 '13 at 16:37
New URL:… (retrieved at 2013-02-16 18:08 UTC+0800) – LiuYan 刘研 Feb 16 '13 at 10:08
I wish we could tweak this locally before good old GNOME developers wake up a little quicker to such important problems reported by users ;-) – Sadi Jan 18 '14 at 13:49
Whoever thought it a good idea to hardcode screenshot names in C, requiring a recompile of the entire desktop environment? Had no one ever thought that a user might want to change the default naming? Now that there is dconf-editor and such, and gnome-screenshot uses it, why not have a dconf entry stting for "screenshot naming policy" which you could set to say Screenshot-%02d.png, and if empty, then go along with the hardcoded naming policy? Eh.... – sdaau Mar 31 at 8:41

Instead of installing additional software and writing this code in the screenshot tool, here's a workaround to rename the files afterwards.

All you need to do is to navigate to the directory and run the following command

rename 's/\:/\-/g' *.png

This will replace all colons with dashes in all file names ending in .png of the ones present in the current directory.

share|improve this answer
Less optimal, but much easier workaround than proposed by fain182. +1 – gertvdijk Feb 4 '13 at 16:36

There is a simple and dirty way to rename all the screenshot taken immediately after the creation, but you will need to install inotify-tools ( apt-get install inotify-tools ) and then you could run this command:

while true; do inotifywait -e CREATE ~/Pictures && rename 's/\:/\./g' Pictures/Screenshot*.png; done;

While this command will run, everytime you save a new screenshot in Desktop/, the script will rename every file containing :, substituting : with .

(Maybe you want change the directory, I don't know wich directory use Gnome 3) If you really like it, you can start this command in a script every time gnome starts.

share|improve this answer
+1 This is a neat little trick, but your regex should be 's/\:/\./g' – mehaase Jul 16 '12 at 19:46
another option of replacement: use the unicode character – LiuYan 刘研 Feb 16 '13 at 10:35
Note that screenshots are saved by default in ~/Pictures, not ~/Desktop. – MestreLion Apr 4 '13 at 3:44

Shutter is another application for taking screenshots which allows you to customize the file name: you can install it from Ubuntu Software Center.

share|improve this answer
Shutter is amazing by itself, and this is imho this is the best approach: instead of fixing bad filenames, do not produce them! – MestreLion Apr 4 '13 at 3:21
For example, the filename in the Shutter may have the following wildcard: $nb_name_%Y-%m-%d-%H%M%S. You can set it in the Preferences. – Vladimir S. Jun 13 '15 at 6:46

gnome-screenshot doesn't allow setting a global default for the screenshot filenames, but you can use the -f option to specify a filename on the commandline.

We can use that to write a small bash script that will take the place of the original gnome-screenshot binary and will execute the original with the correct filename parameter.

Note that you will have to have root privileges for the following operations, so prefix each command with sudo or open a root shell with sudo -i.

  1. Move the original gnome-screenshot binary out of the way:

    dpkg-divert --add --rename --divert /usr/bin/gnome-screenshot.real /usr/bin/gnome-screenshot
  2. Open /usr/bin/gnome-screenshot in an editor (you should see a new empty file):

    editor /usr/bin/gnome-screenshot
  3. Paste the following two lines into the editor:

    gnome-screenshot.real -f "$HOME/Pictures/Screenshots/$(date +%F_%H-%M-%S).png" $@

    You can insert any path you like after the -f; just make sure to enclose it in quotation marks and to keep the $@ after it.
    In this example, the screenshots will be stored with filenames like /home/yourusername/Pictures/Screenshots/2011-07-31_12-13-04.png. See man date for details on the date +%… syntax.

  4. Save the file and close the editor (e.g. using Ctrl + X in Nano or :wq in Vim).

  5. Make the newly created script executable:

    chmod a+x /usr/bin/gnome-screenshot
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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