While most modern Linux systems use a display manager to log in users and start a desktop environment, it's possible to start X11 and your favorite window manager/desktop environment without one. You can start X from a virtual console and even set it up to launch automatically on login. Here's how.
Step 1: Disabling Your Display Manager
Display managers were originally designed to connect remote users to a central server to run X applications. Users would use "X terminals," not to be confused with xterm, which were graphical terminals designed for use with X11. Since most modern PCs run both the X server and applications on the same machine, you can disable them.
If you have a system running systemd, as most modern Linux distros do, you can disable your display manager on startup.
To do that, first, find out which display manager you're using. A clue will be which desktop environment was installed by default. If you use GNOME, GDM will likely be the display manager. If you're a KDE user, it's most likely KDM. Otherwise, it might be XDM or LightDM.
If you're not sure, a good clue is to check the running processes using ps, top, or htop. Look for something in the listing that includes "-dm."
When you know what display manager you're running, it's easy to disable it using systemd. Just use the systemctl command. Here's an example for LightDM:
sudo systemctl disable lightdm.service
Reboot and you'll find yourself in a text-based virtual console. Enter your username and password when prompted and you can run Linux commands in your shell as if you had opened a terminal window. You'll use this to start your desktop, but first, you'll have to set up your .xinitrc file.
Step 2: Set Up Your .xinitrc
To start up your window manager or desktop, you have to set up your .xinitrc file in your home directory first. It's easy to do so. Just open it with your favorite text editor.
Now that you have it open, you'll have to add at least the line that starts your preferred environment. Here's an example to start XFCE:
exec startxfce4
It's important to use "exec" because this will cause the system to log you out when you exit XFCE.
You can also have any programs you want to run when you start X in your .xinitrc. For example:
firefox &
xterm &
xcalc &
exec startxfce4
It's important to add the "&" at the end of any other programs that run before the desktop/window manager. This causes them to run in the background. If you don't, the program will run, and then nothing will happen unless you quit it. This won't even launch your window manager. The .xinitrc is really just a shell script and obeys shell syntax.
Step 3: Using startx at the Command Line
Starting your preferred window manager or desktop environment is simple enough. Just type "startx" at the command line, and if you've configured your .xinitrc file, you should find it running just as if you'd logged in with a window manager.
If you want to start a different window manager than the one you've set up in your .xinitrc, you can just use the absolute pathname of the manager as an argument:
startx /path/to/window/manager
Step 4: Starting X Automatically at Login
You can also start X at login without a window manager. You can modify the shell startup files that only run when you're using a login shell. On Bash, this is .bash_login, and on Zsh, it's .zprofile.
Just add this sequence to the file:
If [ -z "${DISPLAY}" ] && [ "$XDG_VNTR" eq 1 ]; then
exec startx
fi
This bit of shell code checks that the $DISPLAY environment variable is empty (which it will be if X is not running) and that you're logged into virtual console 1. This means that if X is already running, another copy of X won't spawn. It also won't start when you start a shell in a terminal emulator, as this will run the .bashrc or .zshrc files instead.
You Don't Need a Display Manager at Login
As with a lot of things related to GUIs on Linux, running a display manager is strictly optional. You can start X at the command line and even when you log in automatically. You can run Linux without a GUI completely if you want to.