1

I DO NOT want to change the default location for screenshots, nor use interface. I want to use gnome-screenshot in some specific cases to save to a different folder.

I know about the -f or --file option to save to a specific file, but is there a way to save to a directory/folder?

I'm on Ubuntu 17.10.

1

You can use the -f option to specify the directory too. For example

gnome-screenshot -f ~/MyFolder/FileName.png

To avoid overwriting you may add date-time to the file name, for example like this:

gnome-screenshot -f ~/MyFolder/Screenshot\ from\ $(date "+%Y-%m-%d--%H-%M-%S").png
1

Take your screenshot, select where to save from the pull down menu - "Save in folder"

enter image description here

From the command line just specify a location

bodhi@daemon:~$gnome-screenshot -f /home/bodhi/Pictures/testing.123.jpeg

bodhi@daemon:~$ls /home/bodhi/Pictures/ | grep test 
testing.123.jpeg
  • I need to use command line, with no interfaces. I edited my post to specify this. – Daniel Fagundes Nov 16 '17 at 15:23
0

It's a bit of a hack, but if you just want to set a directory and not the filename manually, you can do:

HOME=/path/to/directory gnome-screenshot

gnome-screenshot saves in the ~/Pictures folder by default, since that is what XDG_PICTURES_DIR is usually set to in $XDG_CONFIG_HOME/user-dirs.dirs ("$HOME/Pictures"). But if that directory doesn't exist, or XDG_PICTURES_DIR isn't defined, it dumps the screenshot in $HOME. And since:

  • XDG_CONFIG_HOME is taken to be $HOME/.config if not explicitly set,
  • and there's unlikely to be a .config/user-dirs.dir file in /path/to/directory

this command causes gnome-screenshot to dump the screenshot in /path/to/directory.

Or, less hacky but more complicated, create a directory somewhere (say /path/to/another/dir), with a user-dirs.dir file in it containing:

XDG_PICTURES_DIR="/path/to/dir"

Then you can do:

XDG_CONFIG_DIR=/path/to/another/dir gnome-screenshot

and again the screenshot will end up in /path/to/dir.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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