Every Linux distribution is "a commandline distribution". The fact that you've got KDE, K Desktop Environment, on your Mepis and that it's the default thing you see after the boot process, is just a choice. If you press CTRL+ALT+F1 (trough F6 usually) you'll get a console; if you want to shut X down so there are only text consoles available (and no graphical), it's usually easiest to switch your runlevel (the runlevels may vary on different distributions). For example on a RedHat one used to do this:
to move to runlevel 3 which in that case was text-based. Back to the graphical:
The runlevels and their explanations are found in
/etc/inittab, check it out.
You could just as well either set your default runlevel (in inittab) to be a text-only runlevel, usually 2 or 3, or if you like to do it the harsh way, remove KDE as a whole. 512MB RAM should be much more than sufficiently for running KDE, so either your cpu is very very very slow or then you've got some other problems: I think KDE should run smoothly with only 128MB ram or even less (and yes, with the dingles and dongles it offers). You can get it run smoother by taking some of the effects out (transparency on menus, shadows on menus, ...)
As far as I understand, Mepis is Debian-based so switching to Debian would not make that big a difference. Debian has also all the needed software for X, KDE, Gnome etc. so it's not less graphical than Mepis; you might be mistaken, but on every single Linux distribution where you find graphical user interfaces, you're facing X server (or equivalent) and that's simply a bunch of software. X, in Mepis for example, is not what the system is, it's just one part of the system. I suggest you discover the rest too, before switching distribution to something else just to get "to the command line".