Linux uses a heterogeneous GUI stack, meaning it's arranged in layers but there's different layers you can arrange.
The bottom of the stack is relatively homogeneous, meaning it's almost always the same. This is the Xorg server joan has indicated.
However, while X all by itself does provide you with a graphical desktop, it doesn't look like much -- plain black screen with a cursor. This makes just launching applications difficult, since there are no menus or taskbars either. You can configure a terminal to launch at start up and go from there, but realistically, additional software is needed.
This is where the next two layers, the window manager (WM) and desktop environment (DE) come in. The latter requires the former but not vice versa. There are stand-alone WM's that have most of the features associated with a graphical desktop, but linux distros usually use a more minimal WM with a heftier DE on top.
The default DE on Raspbian was (keep reading) lxde
. If you want that back, I imagine apt install lxde
should do it. There may be more pieces needed in the end -- you can see a list of possibilities with apt-cache search lxde
. The other common linux DE's are also available, but most of them consume more resources which is why lxde was chosen as the default on the pi.
Note that this does not include a graphical login, which is the task of a display manager (DM). The default on raspbian is lightdm
, which you can install with apt-get install lightdm
.
To sum up the two parts you'd need to get the original GUI system back would be:
apt install lxde lxde-core lxterminal lxappearance
apt install lightdm
These should drag in X and other dependencies if they are not there already. If you wish to start X from the command line using startx
or xinit
, you'll need:
The new default DE is the Pi Foundation's tweaked branch of LXDE, PIXEL. Apparently you can install that with:
apt install raspberrypi-ui-mods
This may or may not include a display manager for GUI logins.
apt-file search startx
(finds packages containing file),startx
is in thexinit
package (which you would need to start X usefully...). Probably that got pulled in with the other stuff, but if not, there you go. – goldilocks Jan 14 '15 at 13:31startx
(no GUI login), so what was here was a bit of sketch. – goldilocks Oct 15 '17 at 10:54sudo apt-get install raspberrypi-ui-mods
. I originally came here having uninstalled my UI on Stretch and the currently posted commands were not sufficient (i.e. got me a graphical X desktop, just not the one I expected) until I found https://raspberrypi.stackexchange.com/questions/65848/how-do-i-upgrade-raspbian-lite-to-raspbian-pixel and the corresponding thread on the Raspberry Pi forums. – jdonald Oct 23 '17 at 20:30