Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




OpenSuSE 11.1 Quick Start Guide
Previous Page Home Next Page

8.11 Handling Processes

As you have seen in Section 8.7, Editing Texts, programs can be started from the shell. Applications with a graphical user interface need the X Window System and can only be started from a terminal window within a graphical user interface. To open a file named vacation.pdf in your home directory from a terminal window in KDE or GNOME, simply run xpdf ~/vacation.pdf to start a PDF viewer displaying your file.

When looking at the terminal window again you will realize that the command line is blocked as long as the PDF viewer is open, meaning that your prompt is not available. To change this, press Ctrl+Z to suspend the process and enter bg to send the process to the background. Now you can still have a look at vacation.pdf while your prompt is available for further commands. An easier way to achieve this is by sending a process to the background directly when starting it. To do so, add an ampersand at the end of the command:

xpdf ~/vacation.pdf &

If you have started several background processes (also named jobs) from the same shell, the jobs command gives you an overview of the jobs (including the job number and their status):

[email protected]:~> jobs
[1]   Running        kpdf opensuse111_startup-xep.pdf &
[2]-  Running        kpdf opensuse111_reference-xep.pdf &
[3]+  Stopped        man jobs

To bring a job to the foreground again, enter fg job number.

Whereas job only shows the background processes started from a specific shell, the ps command (run without options) shows a list of all your processes—those you started. Find an example output below:

[email protected]:~> ps
15500 pts/1    00:00:00 bash
28214 pts/1    00:00:00 xpdf
30187 pts/1    00:00:00 kate
30280 pts/1    00:00:00 ps

In case a program cannot be terminated in the normal way, use the kill command to stop the process (or processes) belonging to that program. To do so, specify the process ID (PID) shown by the output of ps. For example, to shut down the Kate editor in the example above, enter

kill 30187

This sends a TERM signal that instructs the program to shut itself down.

Alternatively, if the program or process you want to terminate is a background job and is shown by the jobs command, you can also use the kill command in combination with the job number to terminate this process:

kill % job number

If kill does not help—as is sometimes the case for runaway programs—try

kill -9 PID

This sends a KILL signal instead of a TERM signal, bringing the specified process to an end in most cases.

This section only aimed to introduce the most basic set of commands for handling jobs and processes. Find an overview for system administrators in Section 11.6, Processes, (↑ Reference ).

OpenSuSE 11.1 Quick Start Guide
Previous Page Home Next Page

  Published under the terms fo the GNU General Public License Design by Interspire