Sie sind auf Seite 1von 3

RH135-Day20

Written by Rajib Shahriar Rubence

Process: -----------A process is a an instance of a running program. ps command can be used to list processes. By default only ps command gives you only processes started from this terminal (i.e, terminal from which we gave the ps command). to view ps all processes running in all terminal and behind terminals we issue : # ps aux where a = for all terminal x = for processes running behind terminal u = show the username under which the process is running You can use the ps command in combination with the grep command to see if a process is running. For example, to determine if Emacs is running, use the following command: # ps ax | grep emacs From the output of "ps aux" one of the very important information is PID (stands for process id) . reffering with this pid we can kill (terminate) a process sending single 9 # kill 9 1001 The above command will terminate the process containing pid 1001 Use of top ---------------The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. The top command monitors CPU utilization, process statistics, and memory utilization. The top section contains information related to overall system status - uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space. By Default the output of "top" is sorted by cpu usages. But it can be interactively as followings: M = sort by resident memory use P = sort by CPU Usage N = sort by pid A = sort by age (newest first) You can also kill a process while using top by pressing "k". You'll be prompted for the PID of the task and the signal to send to it. For killing the process send single "9"

1/3

RH135-Day20
Written by Rajib Shahriar Rubence

Process Scheduling (Niceness) ----------------------------A Linux system can have as many process running at the same time as it has CPU cores. A primary task of the Linux kernel is scheduling processes. Every process has a niceness value that influences its scheduling. Niceness is a value which ranges from -20 through default 0 to 19 The higher the niceness the lower the priority The nice and renice commands can change a process's scheduling priority. "renice 0 2789" to change the niceness of process 2789 to 0 Practice LAB: 01. Type "tail -f /var/log/messages" in a terminal. Kill the process from another terminal. - Open a terminal and type "tail -f /var/log/messages" - Open another terinal - get the process id (pid) of running process in first terminal # ps aux |grep tail - kill the process by sending signal 9 # kill 9 1098 (assuming the process id is 1098) 02. Type "tail -f /var/log/messages" in a terminal. Change the nicessness of this process to 10 - Type "tail -f /var/log/messages" in a terminal. - open anoter terminal - get the process id (pid) running with the process # ps aux |grep tail - change the nicenss with renice command # renice 10 1098 (assuming the process id is 1098)

Cron : Managing Periodic Tasks

Linux Crontab Format

2/3

RH135-Day20
Written by Rajib Shahriar Rubence

MIN HOUR DOM MON DOW CMD MIN : Minute allowed field 0 to 59 HOUR: Hour allowed field 0 to 23 DOM: Day of Month allowed field 1-31 MON: Month of the year. allowed field 1-12 DOW Day Of Week. allowed field 0-6. where 0 =sunday and 6=satarday CMD Command Any command to be executed.

This will reboot your computer on 10th June 08:30 AM.

30 08 10 06 * reboot

This will reboot your computer in every 5 minute

*/5 * * * * * reboot

3/3

Das könnte Ihnen auch gefallen