Linux Commands Examples

A great documentation place for Linux commands


an image manipulation and paint program.


gimp [-h] [--help] [--help-all] [--help-gtk] [-v] [--version] [--license] [--verbose] [-n] [--new-instance] [-a] [--as-new] [-i] [--no-interface] [-d] [--no-data] [-f] [--no-fonts] [-s] [--no-splash] [--no-shm] [--no-cpu-accel] [--display display] [--session <name>] [-g] [--gimprc <gimprc>] [--system-gimprc <gimprc>] [--dump-gimprc] [--console-messages] [--debug-handlers] [--stack-trace-mode <mode>] [--pdb-compat-mode <mode>] [--batch-interpreter <procedure>] [-b] [--batch <command>] [filename] ...

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


/usr/bin/gimp -s $@
gimp -i -b '(call_py_flipscale "pics/*.jpg" 120 150)' -b '(gimp-quit 0)'
then /usr/bin/gimp $@
open -a Gimp
gimp -i -b '(simple-sinus-filter "foo.png" "foosin.png")' -b '(gimp-quit 0)'

GIMP for Photoshoppers

Link: Official GIMP Doc.

Link: Handy Tweaks To Make GIMP Replace Photoshop covers a couple features Photoshop has by default, but need to be manually enabled on GIMP.



Tutorial: How to make GIMP have Photoshop's Layout

Tip: Click Edit -> Keyboard Shortcuts, and read down the list. It's a great summary each all GIMP's functions, what keyboard shortcut invokes them, and where they're located in the menus.

Tip: Don't expect any of the keyboard shortcuts to be the same! CTRL+D is now Duplicate, not Deselect. Transform Selection is now SHIFT+T, not CTRL+T, M is now Move, not V...

Tip: The default layer has no "Alpha Chanel", so deleting content (via the eraser, or DEL) erases it to the background colour, not transparent.

Tip: The default transformation interpolation in GIMP is "Cubic", whereas in Photoshop it is "None". You might notice when scaling solid colours and wondering why it fades out...

Tip: Space Bar MOVES now, instead of PAN. So you're no longer moving your view around the image, you're now moving the image around under your view... (At this point I'm considering VM'ing windows...)

Tip: When drawing a line with the pencil tool, if you want it to go straight (horz/vert/diag) in Photoshop you would hold SHIFT before beginning to draw. In GIMP, click once where you want to begin, then hold shift + ctrl, then click where you want to end.


I want to change DPI with Imagemagick without changing the actual byte-size of the image data

Note that you can use exiftool to read out resolutions. For example, exiftool '-*resolution*' c.jpg might show

 Resolution Unit                 : inches
 X Resolution                    : 300
 Y Resolution                    : 300

exiftool also is able to set parameters, but as noted in man page Image::ExifTool::TagNames, the Extra Tags XResolution and YResolution are not writable by exiftool.

I don't know whether ImageMagick has resolution-changing options, but would be surprised if it doesn't. Also, it is straightforward to write gimp scripts to automate tasks like this, and also it is possible to change resolutions with small programs. For example, following is a C program (compilable via gcc setRes.c -O3 -Wall -o setRes) that reads the first few bytes of a jpeg file, changes resolutions to 300, and rewrites them. The program as shown uses constants for little-endian machines, like x86. If run on a big-endian machine it should terminate with a message like Error: xyz may be not a .jpg file, even if xyz is a jpeg file. Note, I haven't tested the resulting pictures via pdflatex; you probably would find it worthwhile to post a question in the tex SE.

/* jiw -- 24 Sep 2012 -- Re: set resolution in a jpg -- Offered without
warranty under GPL v3 terms as at
#include <stdlib.h>
#include <stdio.h>
void errorExit(char *msg, char *par, int fe) {
  fprintf (stderr, "\n%3d Error: %s %s\n", fe, msg, par);
  exit (1);
// Note, hex constants are byte-reversed on little vs big endian machines
enum { JF=0x464a, IF=0x4649, L300=0x2c01, B300=0x012c, NEWRES=L300};
int main(int argc, char *argv[]) {
  FILE *fi;
  short int buf[9];
  int r, L=sizeof buf;
  if (argc<2) errorExit(argv[0], "requires a .jpg file name", 0);
  fi = fopen(argv[1], "r+b");
  if(!fi) errorExit("open failed for", argv[1], ferror(fi));
  r = fread(buf, 1, L, fi);
  if (r != L) errorExit("read failed for", argv[1], ferror(fi));
  if (buf[3] != JF || buf[4] != IF) // Check JFIF signature
    errorExit(argv[1], "may be not a .jpg file", 0);
  buf[7] = buf[8] = NEWRES;
  fseek(fi, 0, SEEK_SET);
  r = fwrite(buf, 1, L, fi);
  if (r != L) errorExit("write failed for", argv[1], ferror(fi));
  return 0;


PDFs open in GIMP on Linux system

A bit of further research found that the offending file was ~/.local/share/applications/mimeapps.lst


Any web designers here made a transition from Photoshop to Gimp?

For a while, I used Gimp and it does work (and save you a small fortune) but I have to say that I just did not like it as much. I had no problems with compatibility but I just could not get on with it.

Gimp slicing works well - my problems were mainly with actual photo effects and editing.

Also, In my experience, Photoshop runs terrible in a VM, especially the newest which uses GPU acceleration.


How do I slice a large image using GIMP?

I am all about using GIMP for everything and love it. However let me suggest ImageMagick for this task. I have a file called kids.png that is 2149x1433. I use the following command found at and end up with 6 images that are identified as follows


convert kids.png  +gravity -crop 1000x1000  tiles_%d.png


tiles_0.png PNG 1000x1000 2149x1433+0+0
tiles_1.png PNG 1000x1000 2149x1433+1000+0
tiles_2.png PNG 149x1000 2149x1433+2000+0
tiles_3.png PNG 1000x433 2149x1433+0+1000
tiles_4.png PNG 1000x433 2149x1433+1000+1000
tiles_5.png PNG 149x433 2149x1433+2000+1000

Then I put them back together with

convert tiles_[0-5].png -mosaic new.png


Free tool to extract objects from photos

Computer vision is a research area and a Hard Problem. I don't think you should expect to find free software that will do a good job of it.


Move all 3 GIMP's windows at the same time?

you can try moving multiple windows at the same time with a script that use "wmctrl"

However Gimp (next versions) will soon consist of a single window, as I heard from the blogs.


How to edit .pub format files on fedora?

The short answer is "no."

The longer answer is that you can probably set up Publisher with CodeWeaver's Crossover Linux with some degree of success.

Probably using that and slowly/rapidly transitioning existing files to Scribus or LibreOffice's Draw would be the best way to go.


How do I create blurry effects with GIMP

The effect you are trying to archive is called "bokeh", and its archived by dslr mirror cameras for parts of the scene that lie outside the depth of field.

I've only ever used photoshop so I cannot tell you the specifics for gimps but, the first thing you should do is select what you don't want blurred and place it on a different layer, then apply some sort of filder to blur out the background. I do not think gimp has a depth of field blur filter, so using a gaussian blurr will not give you a 'real' bokeh effect, but it'll be close enough.

This tutorial will show you step by step how to do it. Also btw, this question should probably be moved to graphical design.


Troubleshooting X sudden restart/crash using XFCE 4.8 with stylus pen

I was having this problem as a result of the 'x' media key (f4) on my lenovo p500. The f4 key is by default an '[x] close' key. Unless I hit fn first.

Anyway, pressing said key on the desktop kills xfce in one keystroke. My current solution is to disable it with xmodmap:

  1. Use xev to read the keycode (focus the window and press the media key)
  2. Use xmodmap -e 'keycode #=' to disable it, ie: xmodmap -e 'keycode 64='

Using a CMYK .psd file with The Gimp

Have you tried the 'separate' plugin for gimp? Arch link as it's pretty informative and complete:

the GEGL version of gimp should improve CMYK support and other bitdepths (than 8) and is scheduled for 2.10. This will eliminate the need for a plugin.


GIMP command line, how to invert color of a list of picture and modify the color of them (by colorize, but in command line)

You're going to have an easier time doing this with something like ImageMagick than GIMP on the command line.

With ImageMagick, you can use the negate command:

convert image.jpg -negate negated-image.jpg

And then colorize it:

convert negated-image.jpg -colorize 0,50,0 colorized-image.jpg


multilingual font in gimp (ubuntu linux)

The GIMP does not transliterate text; use a IME if you want to input text in an alphabet your keyboard does not support.


How to use GIMP as an image viewer?

Your question is like asking how to use Photoshop as a simple image viewer. As Sampo said, GIMP is simply not designed for it. Using GIMP in this way is like using a car to go from the kitchen to the bathroom. You can do it, but it isn't really worth the trouble and it doesn't make the trip any easier.

Depending on what Linux distribution and Desktop Environment you use, you almost certainly already have an image viewer installed. Here are the defaults for some of the most popular Desktop Environments.

Gnome: eog
KDE: gwenview
XFCE: ristretto

One of these is sure to already be installed in your system.


GIMP is the GNU Image Manipulation Program. It is used to edit and manipulate images. It can load and save a variety of image formats and can be used to convert between formats.

GIMP can also be used as a paint program. It features a set of drawing and painting tools such as airbrush, clone, pencil, and paint brush. Painting and drawing tools can be applied to an image with a variety of paint modes. It also offers an extensive array of selection tools like rectangle, ellipse, fuzzy select, bezier select, intelligent scissors, and select by color.

GIMP offers a variety of plug-ins that perform a variety of image manipulations. Examples include bumpmap, edge detect, gaussian blur, and many others. In addition, GIMP has several scripting extension which allow for advanced non-interactive processing and creation of images.

GIMP ships with a second binary called gimp-console. This binary is a console-only version and behaves as if gimp was called with the --no-interface command-line option.

On platforms with the D-Bus message bus system, GIMP will by default check if an instance is already running in this user session. If it detects that, it will pass all filenames given on the command-line to the already running GIMP instance and quit.


GIMP accepts the following options:
-h, --help

Show GIMP command-line options.


Show all command-line options.


Show GTK+ command-line options.


Show GEGL command-line options.

-v, --version

Output version information and exit. When combined with the --verbose option, version information about libraries used by GIMP is shown as well.


Output license information and exit.


Be verbose and create information on standard output.

-n, --new-instance

Do not attempt to reuse an already running GIMP instance. Always start a new one.

-a, --as-new

Open filenames passed on the command-line as new images, don’t set the filename on them.

-i, --no-interface

Run without a user interface.

-d, --no-data

Do not load patterns, gradients, palettes, or brushes. Often useful in non-interactive situations where startup time is to be minimized.

-f, --no-fonts

Do not load any fonts. No text functionality will be available if this option is used.

--display display

Use the designated X display.

-s, --no-splash

Do not show the splash screen.


Do not use shared memory between GIMP and its plug-ins. Instead of using shared memory, GIMP will send the data via pipe. This will result in slower performance than using shared memory.


Do not use CPU accelerations such as MMX or SSE even if GIMP detects that your CPU provides this functionality.

--session <name>

Use a different sessionrc for this GIMP session. The given session name is appended to the default sessionrc filename.

-g, --gimprc <gimprc>

Use an alternative gimprc instead of the default one. Useful in cases where plug-in paths or machine specs may be different.

--system-gimprc <gimprc>

Use an alternate system gimprc file.


Output a gimprc file with default settings.


Enable debugging signal handlers.

-c, --console-messages

Do not popup dialog boxes on errors or warnings. Print the messages on the console instead.

--stack-trace-mode {never|query|always}

If a stack-trace should be generated in case of fatal signals.

--pdb-compat-mode {off|on|warn}

If the PDB should provide aliases for deprecated functions.

--batch-interpreter <procedure>

Specifies the procedure to use to process batch events. The default is to let Script-Fu evaluate the commands.

-b, --batch <command>

Execute <command> non-interactively. This option may appear multiple times. The <command> is passed to the batch interpreter. When <command> is - the commands are read from standard input.


GIMP respects a number of environment variables.


to get the default host and display number.


to get the name of the personal GIMP directory. If unset .gimp-2.8 is used. If this is an absolute path, it is used as is. If it is a relative path, it is taken to be a subdirectory of the home directory.


to get the base location for data files such as brushes and patterns. If unset ${datarootdir}/gimp/2.0 is used.


to get the base location for translations. If unset ${datarootdir}/locale is used.


to get the base location for plug-ins and modules. If unset ${exec_prefix}/lib/gimp/2.0 is used.


to get the location of configuration files. If unset /etc/gimp/2.0 is used.

On Linux GIMP can be compiled with support for binary relocatibility. This will cause data, plug-ins and configuration files to be searched relative to the location of the gimp executable file unless overridden by the environment variables mentioned above.


GIMP’s data files are stored in ${datarootdir}/gimp/2.0, where ${datarootdir} is set on install, but is typically /usr/share. GIMP’s system-wide configuration files are stored in /etc/gimp/2.0, where ${prefix} is typically /usr.

Most GIMP configuration is read in from the user’s init file, $HOME/.gimp-2.8/gimprc. The system wide equivalent is in /etc/gimprc. The system wide file is parsed first and the user gimprc can override the system settings. /etc/gimprc_user is the default gimprc placed in users’ home directories the first time GIMP is run.

$HOME/.gimp-2.8/devicerc - holds settings for input devices together with the tool, colors, brush, pattern and gradient associated to that device.

$HOME/.gimp-2.8/gtkrc - users set of GIMP-specific GTK+ config settings. Options such as widget color and fonts sizes can be set here.

/etc/gimp/2.0/gtkrc - system wide default set of GIMP-specific GTK+ config settings.

$HOME/.gimp-2.8/menurc - user’s set of keybindings.

$HOME/.gimp-2.8/parasiterc - Stores all persistent GIMP parasites. This file will be rewritten every time you quit GIMP.

$HOME/.gimp-2.8/sessionrc - This file takes session-specific info (that is info, you want to keep between two GIMP sessions). You are not supposed to edit it manually, but of course you can do. This file will be entirely rewritten every time you quit GIMP. If this file isn’t found, defaults are used.

$HOME/.gimp-2.8/templaterc - Image templates are kept in this file. New images can conveniently created from these templates. If this file isn’t found, defaults are used.

/etc/gimp/2.0/unitrc - default user unit database. It contains the unit definitions for centimeters, meters, feet, yards, typographic points and typographic picas and is placed in users home directories the first time GIMP is ran. If this file isn’t found, defaults are used.

$HOME/.gimp-2.8/unitrc - This file contains your user unit database. You can modify this list with the unit editor. You are not supposed to edit it manually, but of course you can do. This file will be entirely rewritten every time you quit GIMP.

$HOME/.gimp-2.8/plug-ins - location of user installed plug-ins.

$HOME/.gimp-2.8/pluginrc - plug-in initialization values are stored here. This file is parsed on startup and regenerated if need be.

$HOME/.gimp-2.8/modules - location of user installed modules.

$HOME/.gimp-2.8/tmp - default location that GIMP uses as temporary space.

${datarootdir}/gimp/2.0/brushes - system wide brush files.

$HOME/.gimp-2.8/brushes - user created and installed brush files. These files are in the .gbr, .gih or .vbr file formats.

$HOME/.gimp-2.8/curves - Curve profiles and presets as saved from the Curves tool.

$HOME/.gimp-2.8/gimpressionist - Presets and user created brushes and papers are stored here.

$HOME/.gimp-2.8/levels - Level profiles and presets as saved from the Levels tool.

${datarootdir}/gimp/2.0/palettes - the system wide palette files.

$HOME/.gimp-2.8/palettes - user created and modified palette files. This files are in the .gpl format.

${datarootdir}/gimp/2.0/patterns - basic set of patterns for use in GIMP.

$HOME/.gimp-2.8/patterns - user created and installed gimp pattern files. This files are in the .pat format.

${datarootdir}/gimp/2.0/gradients - standard system wide set of gradient files.

$HOME/.gimp-2.8/gradients - user created and installed gradient files.

${datarootdir}/gimp/2.0/scripts - system wide directory of scripts used in Script-Fu and other scripting extensions.

$HOME/.gimp-2.8/scripts - user created and installed scripts.

${datarootdir}/gimp/2.0/gflares - system wide directory used by the gflare plug-in.

$HOME/.gimp-2.8/gflares - user created and installed gflare files.

${datarootdir}/gimp/2.0/gfig - system wide directory used by the gfig plug-in.

$HOME/.gimp-2.8/gfig - user created and installed gfig files.

${datarootdir}/gimp/2.0/images/gimp-splash.png - the default image used for the GIMP splash screen.

${datarootdir}/gimp/2.0/images/gimp-logo.png - image used in the GIMP about dialog.

${datarootdir}/gimp/2.0/tips/gimp-tips.xml - tips as displayed in the "Tip of the Day" dialog box.

other info

The canonical place to find GIMP info is at Here you can find links to just about many other GIMP sites, tutorials, data sets, mailing list archives, and more.

There is also a GIMP User Manual available at that goes into much more detail about the interactive use of GIMP.

The latest versions of GIMP and the GTK+ libs are always available at

splash images

GIMP comes with a default image for the splash screen but it allows system administrators and users to customize the splash screen by providing other images. The image to be used with the splash screen is chosen as follows:


GIMP tries to load a random splash screen from the directory $HOME/.gimp-2.8/splashes.


It then falls back to using $HOME/.gimp-2.8/gimp-splash.png.


If the user didn’t install any custom splash images, a random image is picked from ${datarootdir}/gimp/2.0/splashes.


As a last resort, GIMP uses the default splash image located at ${datarootdir}/gimp/2.0/images/gimp-splash.png.

suggestions and bug reports

Any bugs found should be reported to the online bug-tracking system available on the web at Before reporting bugs, please check to see if the bug has already been reported.

When reporting GIMP bugs, it is important to include a reliable way to reproduce the bug, version number of GIMP (and probably GTK+), OS name and version, and any relevant hardware specs. If a bug is causing a crash, it is very useful if a stack trace can be provided. And of course, patches to rectify the bug are even better.

see also

gimprc, gimptool,


Spencer Kimball, Peter Mattis and the GIMP Development Team.

With patches, fixes, plug-ins, extensions, scripts, translations, documentation and more from lots and lots of people all over the world.

How can this site be more helpful to YOU ?

give  feedback