Professional Documents
Culture Documents
Process Managemnt in Linux
Process Managemnt in Linux
To track the running processes on your machine you can use the top
command.
To displays the currently-running processes.
ps command
To display all the currently running processes
ps -A
List all the signals use
kill -L
Kill any particular process
Kill -9 pid
To assign the nice value to any particular process
nice -n [value] [process name]
Niceness value can range from -20 to 19. 0 is the default value.
sleep 5
Stop a foreground process in between its execution
Sleep 100
Press cntrl Z
To run all the pending and force stopped jobs in the foreground.
fg
sleep 100&
To run processes with priority.
ps PID
Command to check free disk space(Hard Disk) on all the file systems.
df
If you want in human readable format
df -h
This command shows the free and used memory (RAM) on the Linux
system.
free
C program:
#include <stdio.h>
int main()
{
printf("Learning C");
}
Read user input
#include <stdio.h>
int main()
{
char name[100];
int age;
printf("Enter your name: ");
scanf("%s",name);
printf("Enter your age: ");
scanf("%d",&age);
printf("Hello, %s,You are %d years old", name, age);
}
Find even numbers from a list using while loop
#include <stdio.h>
int main(){
int numbers[10] = { 21, 78, 62, 90, 55, 10, 85, 45 };
int i = 0;
printf("The even numbers from the list are:\n");
while(i < 10) {
if((numbers[i] % 2) == 0)
printf("%d\n", numbers[i]);
i++;
}
}
Find out the area of a rectangle using the function
#include <stdio.h>
int area(int h, int w);
int area(int h, int w)
{
int area = h * w;
return area;
}
int main()
{
int height, width;
printf("Enter the height of the rectangle:");
scanf("%d", &height);
printf("Enter the width of the rectangle:");
scanf("%d", &width);