You can use a GPLed program from your own program without your program being affected by the GPL, but you cannot link the GPLed code into your own program without your program becoming subject to the GPL's terms.
In the example provided in the question, in which you have written a GUI wrapper around an existing command-line program, your GUI is not bound by the terms of the GPL, provided that it is a separate program which runs the GPLed program in a separate process and communicates with it only via the existing interface(s) - e.g., over the command line and/or via stdin/stdout.
Some relevant bits from GPL FAQ:
Where's the line between two separate programs, and one program with
two parts? This is a legal question, which ultimately judges will
decide. We believe that a proper criterion depends both on the
mechanism of communication (exec, pipes, rpc, function calls within a
shared address space, etc.) and the semantics of the communication
(what kinds of information are interchanged).
If the modules are included in the same executable file, they are
definitely combined in one program. If modules are designed to run
linked together in a shared address space, that almost surely means
combining them into one program.
By contrast, pipes, sockets and command-line arguments are
communication mechanisms normally used between two separate programs.
So when they are used for communication, the modules normally are
separate programs. But if the semantics of the communication are
intimate enough, exchanging complex internal data structures, that too
could be a basis to consider the two parts as combined into a larger
Can I release a non-free program that's designed to load a GPL-covered plug-in?
It depends on how the program invokes its plug-ins. For
instance, if the program uses only simple fork and exec to invoke and
communicate with plug-ins, then the plug-ins are separate programs, so
the license of the plug-in makes no requirements about the main
If the program dynamically links plug-ins, and they make
function calls to each other and share data structures, we believe
they form a single program, which must be treated as an extension of
both the main program and the plug-ins. In order to use the
GPL-covered plug-ins, the main program must be released under the GPL
or a GPL-compatible free software license, and that the terms of the
GPL must be followed when the main program is distributed for use with
If the program dynamically links plug-ins, but the
communication between them is limited to invoking the ‘main’ function
of the plug-in with some options and waiting for it to return, that is
a borderline case.
Note that the GPL applies in full to the underlying command-line program in any case - if you distribute it (as opposed to having users obtain it from another source), you are responsible for providing a copy of the GPL to users, making it clear to them that the command-line program is under the GPL (even if the GUI wrapper isn't), and making the command-line program's source code available to them on request. From the GPL FAQ again:
If people were to distribute GPL-covered software calling it “part of”
a system that users know is partly proprietary, users might be
uncertain of their rights regarding the GPL-covered software. But if
they know that what they have received is a free program plus another
program, side by side, their rights will be clear.
Standard disclaimer: I am not a lawyer and, even if I were a lawyer, I'm not your lawyer. If you need a definitive answer, consult an appropriate legal professional who is licensed to practice in your jurisdiction.