SYS: Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes.

Share this link

Note: This is an RHCSA 7 exam objective.

System Activities

To get an instantaneous image of a server activity (use ‘virt-top‘ on a KVM hypervisor), type:

# top

To get details about processes, type:

# ps -edf

Process Priority

To start a process (here script.sh) with a low priority, type:

# nice -n 10 ./script.sh

To change the priority (here +5) of an already running process, get its PID (Process ID) through top or ps (here 789) and type:

# renice +5 789

Alternatively:

# renice +5 `pgrep script.sh`

Process Deletion

To kill the process, get its PID through top or ps (here 789) and type:

# kill -9 789

Alternatively:

# pkill script.sh

System Reporting

To display details about IO activities, type:

# iostat

To show network card activities, type:

# netstat -i

To display socket activities, type:

# netstat -a

To get details about virtual memory activities (memory, swap, run queue, cpu usage, etc) every 5 second, type:

# vmstat 5

To get a full report of a server activity, type:

# sar -A

Additional Resources

You can also watch a video by Sander van Vugt about Understanding Linux Memory Usage (4min/2016).

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

5 Comments on "SYS: Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes."

Notify of
Sort by:   newest | oldest
val
Member
val

Just a comment about `kill -9` This is not the default behavior and rarely used on for well written programs. `kill` sends SIGTERM as default to a process so the process needs time for a clean up of open files, FD’s etc.

Gjorgi
Member
Gjorgi

I guess PackageKit isn’t a well written program, since I have to put up a fight with it first via several kill -9 on it before being able to use yum install to install stuff on my virtual CentOS installation.

robs
Member
robs

Long time Solaris / Linux newbie. A note on sar that is probably apparent to most but I had to do a look up on it: it is a part of the sysstat tool set that did not get installed on my minimum distro.
yum install sysstat
Great site, using it for RHCSA at the moment and feeling pretty well prepared after a week of intense studying!

wpDiscuz

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create two users "tom" and "engine". "tom" has the UID/GID 3000 and "engine" the UID/GID 4000. "engine" doesn't have an interactive shell.

RHCE7: Task of the day

Allowed time: 3 minutes.
Configure your machine to be a router.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...