Novell is now a part of Micro Focus

Basics: Restarting KDE from a Command Prompt

Novell Cool Solutions: Feature
By Stomfi

Digg This - Slashdot This

Posted: 4 Feb 2005

Question: I decided to update my Linux installation with all the patches on Novell's web site. After rebooting, Linux boots to a command prompt. I know just enough basic commands to login in and get around but cannot figure out how to restart the KDE gui. What is the command(s) required to restart the KDE gui? Thanks. Frank

Answer: For SUSE

The first thing to do is to make sure that KDE will start up from the command line. On SUSE, KDE is installed into the /opt/kde3 folder and all the commands can be found in the bin sub folder. This directory will probably not be in your path as KDE set this in its start up routine.

Your path is a list of folders where Linux looks for commands (Tools, Utilities and Applications) to run.

You can find out your path with the command line:

$ echo $PATH

The command to start the KDE GUI (Graphical User Interface) is a shell script called "startkde".

The script checks to see that everything is cool for it to run correctly, and adds its command folder to your path.

It does lots of other checks and sets up its graphics, fonts, and user preferences. Then it starts the X server and KDE.

Running the command from the command line will let you see any error messages in case it does not start properly. What you do about these is beyond the scope of this answer as there could be many reasons why it didn't work. Hopefully the error messages will be self explanatory.

You can run this command in two ways. Either by giving the full path name thus:

$ /opt/kde3/bin/startkde

or by:

$ cd /opt/kde3/bin

$ ./startkde

If this works you presumably want KDE to automatically start when you change your run level to the GUI interface one or you reboot your computer. (Me, I hardly ever reboot. I only switch off the monitor)

Run levels are part of the Linux Operating Environment.

They are entered during the initialisation process via the initialisation table.

The start up file /etc/inittab contains the table.

One of them is earmarked as the default.

The ones that start with the command prompt are usually used when running servers and firewalls or doing administrative work, where a GUI is added overhead on resources. These run levels are 1,2, & 3

Here are all the run levels:

0 halts the system

1 single user mode (usually for doing repairs or compiling and testing new software)

2 multi user without networking (usually for administrating multi user software without networking)

3 multi user with networking (The usual one for command line work or running servers etc)

4 is not used in SUSE

5 is as level 3 with GUI interface. (This is the usual level for the desktop user)

6 reboots the system

Here is a copy of the top part of my inittab with the default run level set to 5:


# /etc/inittab


# Copyright (c) 1996-2002 SUSE Linux AG, Dusenberg, Germany. All rights reserved.


# Author: Florin La Roche, 1996

# Please send feedback to


# This is the main configuration file of /sbin/init, which

# is executed by the kernel on startup. It describes what

# scripts are used for the different run-levels.


# All scripts for runlevel changes are in /etc/init.d/.


# This file may be modified by SUSEconfig unless CHECK_INITTAB

# in /etc/sysconfig/suseconfig is set to "no"


# The default runlevel is defined here


# First script to be executed, if not booting in emergency (-b) mode


# /etc/init.d/rc takes care of runlevel handling


# runlevel 0 is System halt (Do not use this for initdefault!)

# runlevel 1 is Single user mode

# runlevel 2 is Local multiuser without remote network (e.g. NFS)

# runlevel 3 is Full multiuser with network

# runlevel 4 is Not used

# runlevel 5 is Full multiuser with network and xdm

# runlevel 6 is System reboot (Do not use this for initdefault!)


l0:0:wait:/etc/init.d/rc 0

l1:1:wait:/etc/init.d/rc 1

l2:2:wait:/etc/init.d/rc 2

l3:3:wait:/etc/init.d/rc 3

#l4:4:wait:/etc/init.d/rc 4

l5:5:wait:/etc/init.d/rc 5

l6:6:wait:/etc/init.d/rc 6

# what to do in single-user mode

ls:S:wait:/etc/init.d/rc S


# what to do when CTRL-ALT-DEL is pressed

ca::ctrlaltdel:/sbin/shutdown -r -t 4 now

Although as root, you can edit this file directly to change the default run level, it is better to use the SUSE administration tool Yast.

Just to make doubly sure that everything will work as expected log out of KDE and back to the prompt.

Log in as root, or use the command "Su -" to get root access.

Give the command:

$ init 5

This will change your run level to 5 and ask you to log in in the usual way on the graphical screen.

From the desktop menu select System -- Yast.

You will have to give the root password.

In the Yast window select System - Run Level Editor as shown.

This is the Run Level Editor window full of warnings, Simple Mode. Highlight the Expert Mode radio button and the window will change.

This is the changed window. Notice that the run level is shown as 3.

Use the drop down list to change the default run level to 5.

Click the finish button and Yast will do all the admin work to change your default run level. Click the close button on the Yast screen and you are done.

If you want to check Yast has done the job, use a terminal console and give the command:

$ cat /etc/inittab

You should see your default run level is now set to 5.

This Newbie answer has covered:

How to find out which folders are searched for running commands.
How to run the KDE GUI from the command line.
How to see the default run level.
What the different run levels are for.
How to change the run level from the command line.
How to use Yast in the GUI to change the default run level.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates