Process Management - Linux
- A process is a program under execution. (or)
- A process is a instance of a running program.
- Process have their own address space in memory, thread of execution, and characteristics such as security context, environment and current priority.
- The Linux kernel tracks every aspect of a process by its process ID number information about each process is advertised by the kernel to user program through the / process/ PID
- When a process starts another program, the new process is called child process. This original process is the parent process of its child process. Child process inherit characteristics from its parent, such as its environment and the user and groups its as which its run.
- There are two types of process in linux:
(a) Foreground process.
(b) Background process.
(a) Foreground process:
---> In Foreground user can execute only one process (or) job.
EX: $ fire fox
- To kill the foreground job in linux:
Ctrl + C
EX: 2) $cp file1 file2
- Background Process:
---> In Background user can execute many jobs at a time.
EX: $fire fox &
$ cp file1 file2 &
---> To check the jobs list in linux: $jobs
PS: Displays information about running process.
- To view process with more detailed information:
$ ps U
- I can detailed about a particular process:
$ ps aux / grep ssh
$ ps aux
Kill: Terminates a process
Syn: $kill PID
$ kill 4286
Sometimes if the kill command doesn’t work the way you intended it to, you can also call it with the -9 optionto give it priority on the system.
$Kill -9 4286
Signal: The operating system communicates to process through signals. These signals report events or error situations to processes. In many cases signals will result in the process existing
- One typical signal is SIGTERM, which terminates the process; it asks it to exit cleanly.
- Another is SIGKILL, which kills the process; the process is required to exit immediately.
- To find the PID(s_ belonging to the SSH service:
$ pidof sshd
$ Pgrep sshd
Top: Monitors system resources (similar to task manager in windows)
S ---> To change the time interval for updating top results (Sec’s)
R ---> To sort by PID number
U ---> Username to get only that user process details
P ---> To sort by CPU utilization .
M ---> To sort by RAM utilization .
C ---> To display or hide command full path.
R ---> To renice a process
K ---> To kill a process
W ---> To save the modified configuration
Z ---> to Quit
---> When you’re comfortable working with processes, you can then make some more advanced adjustments, such as changing the priority of a particular process.
Renice: Adjusts the priority of a particular process.
Syn: renice <priority> [options]
-p changes process priority for a particular PID
-u changes process priority for a particular user(s)
---> The priority value range from -20 (first priority) to 20 (dead last priority). Only the root user may set processes to use a priority under o.
#renice -2 3874
* Note: If all ready processes have the same priority, they will share the processor equally. Priority only has an effect when two process at different priority levels are computing for CPU time, In which case the lower priority process will get less time & appear to run more slowly.
Nohup: The nohup jobs will create in server account so nohup jobs will execute even the user disconnects from his account.
Ex: $nohup cp files1 file2 &
$nohup fire fox &
- The main concept of communication facility exchanging of information or files from one user to another user.
Write: It is used for to write message to another user account, but he should be logged into the user.
$write user name/terminal name
Ctrl+d (Save & quit)
- To deny messages : $mesg n
- To allow messages : $mesg y
Wall: It is used for to send broadcast message to all users who are connected to server
Welcome to linux ______________
Ctrl+d (save & quit)
Mail: Using mail command you can quickly and efficiently circulate memos and other written information to your co-workers you can even send and receive mails from people outside your organization.
$ mail email@example.com single user
$mail user1 user2 user3 multiple users at a time
$ mail user1<stud
It translates files to user.
$ mail user2<backup-file
- Mails are stored in mailbox: (/var/spool/mail/username)
- Go open the mail box: $mail
Learn Linux by Tekslate - Fastest growing sector in the industry.
Explore Linux Training Online and course is aligned with industry needs & developed by industry veterans.
Tekslate will turn you into Linux Expert.
Note: By default all mails will store in primary mail box (Nor/spool/mail). It will opened mails in primary mail box transferred to secondary mail box (i.e mbox)
àTo open secondary mail box: $mail – f
- The primary mailbox only maintains unread mails.
Mail box options: Q ---> quit d --> delete
R --->reply d2 ---> delete 2nd mail
P ---> print w filename --> IT writes to new file
* One Bit Equals t how many bytes:
- Bit is the smallest component of data and byte is larger than bit size. The size 1000 can be replaced with 1024 and still be correct using the other acceptable standards. Both of these standards are correct depending on what type of storage you are referring.
Processor (or) virtual storage Disk Storage
1 bit = Binary digit 1 bit = binary digit
8 bits = 1 byte 8 bits = 1 byte
1024 bytes = 1 kilobyte 1000 bytes = 1 kilo
1024 kilo = 1 mega 1000 kilo = 1 mega
1024 mega = 1 Giga 1000 mega = 1Giga
1024 Giga = 1 Tera 1000 Giga = 1 Tera
1024 Tera = 1 Peta 1000 Tera = 1 Peta
1024 peta = 1 exa 1000 peta = 1 Exa
1024 exa = 1 zetta 1000 Exa = 1Zetta
1024 zetta = 1 yotta 1000 Zetta = 1 Yotta
1024 yotta = 1bronto 1000 Yotta = 1 Bronto
1024 Bronto = 1 Geo 1000 Bronto = 1 Geo
For indepth understanding of Linux click on