linux process, What is Linux Process? Important commands for Linux Process, Hostripples Web Hosting

What is Linux Process? Important commands for Linux Process

In an operating system, to complete a certain operation or task, the processes are required, Process is nothing but a running task or a system of users tasks. When you visit any website, lots of processes start running on the server, even though if you do not visit the website still there are lots of processes going on the server called system processes which are essential to keep the server in running condition.

Every process consumes CPU, RAM, and memory resources. We always heard the term called server load is increases or CPU consumption increases on the server which is nothing but the number of processes running on server start utilizing all or more resources. Each server has limited resources it depends on server nature, if the server is designed for the text blog sharing purpose then it might require less CPU power, small memory, and RAM. If the server is designed for file transferring or sharing purpose then it will require more RAM and CPU power. Similarly, if the server is designed for video streaming photo sharing purpose then it will require more memory and RAM as well as CPU for processing. In short, server design is based on their nature of use. To balancing a load of CPU, memory, and RAM on the server, handling and managing the process is most important. This can be done by using commands.

In this article, we are going to see what is Linux process? Also some commands for Linux processes.

Also read 
https://blog.Hostripples.com/list-of-basic-commands-for-xen-vps-openvz-servers/

There are 2 main types of processes.

Parent process and another one called a child process. For example, you want to play music on your computer in this case opening a music player is a first process called parent process, and playing your favorite music inside your that player is the second process called the child process

Linux Parent Process:

Every process running on the server is called a parent or also known as the primary process.

Linux Child Process:

When a process creates another process then the first original process gets called a parent process and created by the parent process called a child process.

The best way to understand this term is, after finishing the boot process in the Linux machine the first process initiated by the kernel is a systemd or initthis first process is called parent process after that systemd or init relaunch multiple different processes get called as a child process.

There are several status of a process, from which it can be decided that what is the exact behavior of that process currently is.

– D                          —Uninterrupted sleeping.

– R                           —Running.

– S                           —Sleeping.

– T                           — Stop.

– Z                           —Zombie.

Now when you have a command-line interface on server or your local machine and you need to check and maintain the processes or load then you can access them by commands.

Let’s see some of the most important commands while performing process related tasks.

linux process, What is Linux Process? Important commands for Linux Process, Hostripples Web Hosting

top

To show top 10 RAM consuming processes.

linux process, What is Linux Process? Important commands for Linux Process, Hostripples Web Hosting

When you enter a top command on your terminal it will show you output something like this

Let see what it defines one by one.

  • PID:      It is a process ID, whenever a new process gets created it get assigned with unique Process ID each process had different PID.
  • USER:   It is the name of the user or the process owner who initiated the process.
  • PR:         It tells the priority of the process.
  • NI:          Nice Value helps to set the priority of the process.
  • VIRT:     Virtual Memory use swapped memory pages.
  • RES:       Resident Memory is the physical memory used by the process.
  • SHR:       Shared RAM.
  • S:            Process Status.
  • %CPU:  It tells how much CPU is currently the process is using.
  • %MEM: It tells how much memory is currently the process is using.
  • TIME+:  It shows the total time duration of the process from the start.
  • COMMAND:  Process name.

ps

It shows the process status

ps -aux

It shows you all users running processes in a standard format.

(-a ———all.

-u ———user.

-x ——— standard format)

ps -fu <user_name>

It will show you full processes running by the user.

(-f  ———full.

-u ———user.)

pstree-p

It will show you the tree structure of processes with PID.

top -u <user_name>

Show all particular users process.

(-u ———user)

pidof top Or pgrep top

It will display PID of running processes.

kill -9 <PID_number>

To kill a particular PID process forcefully.

(-9  ———forcefully.)

killall -9 <process_name>

To kill a particular process forcefully by its name.

(-9 ———forcefully.)

killall -u <user_name>

To kill a particular user all process by username.

(-u ———username.)

renice -n  -<nice_value><PID_number>

To change priority of running processes.

(-n  ———nice value.)

nice -n -<nice_value><process_name>

To run a program with modified scheduling priority.

(-n ———-nice value.)

uptime

To show system uptime and system load.

df -hT

It shows the file system disk space uses.

(-h ———human readable. -T ———filesystem type.)

free -h

To show memory size and swap partition size.

(-h  ———human-readable.)

lscpu

To show CPU information.

pkill

Terminate a process by process name.

ps -auxf 

It shows the process status with their with process path.

Conclusion:

As of now, we have seen, what is a Linux process, types of process, and also basic commands to handle the Linux processes. Now you can try these commands on your local machine but be safe while using these commands on a server machine because a wrong command may affect your server badly.

I hope this article helps you in some way. If you are getting stuck at some point please feel free to forward any queries to us.


What is Linux Process? Important commands for Linux Process, Hostripples Web Hosting
Mayuresh Vaidya
Mayuresh Vaidya is an electronics and telecommunication engineer having an experience in embedded technology he worked on many technologies such as raspberry pi, Arduino, along IOT home automation devices based on Google and Alexa, also he had good interest in emerging technologies such as IOT, digital marketing, and web related technologies such as hacking and securities.