LINUX INTERVIEW QUESTIONS

1)What is Linux ?

    1) Linux is a Unix based Operating System.

    2) It was first Introduced by Linus Torvalds.

    3)It is an Open Source Operating System that was designed to provide free and a low
       cost operating system for the computer users.

2)Difference between  Linux and Windows ?

1)Linux is a open source operating system
    Windows is not a open source operating system

 2) Linux is free of cost.
     Windows is costly.

 3)In Linux, Monolithic Kernel is used
     In Windows, Micro Kernel is used

 4) It Provides more security than Windows.
      It Provides less security than Linux.

3)Difference between Linux and Unix ?

LINUX
UNIX
The source code of Linux is freely available to its users.
The source code of unix os not available for the general public.
Linux primarily uses GUI with an optional CLI.
Unix primarily uses CLI.
Linux OS  is portable
Unix is not portable.
Linux is used on home based PC’s, Mobile Phones, Desktops.
Unix had a rigid environment of the hardware
Different versions of Linux are Ubuntu, Linux Mint and Red Hat.
Different versions of Unix are AIS, HP-UX, BSD, Iris.
Linux Installation is economical and doesn’t require much specific and high end hardware.
Unix Installation is comparatively costlier as it requires more specific hardware circuitry.
4)Difference between  Linux and MAC OS ?

LINUX
MAC OS
Open-Source
Commercial
Install  Everywhere
Default only on MAC
Community Support
Great Support
Very Customizable
Limited Customizable
Linux has come in 1991
It was developed in 1984

5)What is Operating System(Resource Manager) ?

  An operating system is the software that manages the sharing of the resources of
  a computer and provides programmers with an interface that is used to access
  those resources.

6)What are the functions of an operating system ?

 1) Process Management.

 2)Memory Management

 3)I/O system Management

 4)File Management

 5)Network Management

7)What are the features of UNIX ?

   1) It is a simple user interface.

  2)It is Multi-User and Multiprocessing System

  3) It is a Time-Sharing Operating System.

  4) It is written in C.

  5) It has a consistent file format.

  6) It support Languages such as FORTRAN, BASIC, PASCAL, Ada, COBOL, LISP.

8)What are features of Linux ?

   1)Portable

   2)Open Source

   3)Multi-User

   4)Multi Programming

   5)Hierarchical File System

   6)Shell

9)What is Shell?

1)Shell is Command language interpreter takes commands from the user  and  
    executes Kernel's functions.

2) Shell is an Application, not a Service.


Note: Applications are Optional, Services are Mandatory.

10)What is  a bash ?

 1)Bash is a shell program written by Brian Fox as an upgraded version of Bourne
     Shell Program ‘sh’.

 2) Bash is short for Bourne Again shell.

 3) It is an open source GNU Project.

 4)It was released in 1989 as one of the most popular shell distribution of GNU/Linux
     Operating systems.

5)It provides functional improvements over Bourne Shell for both programming
    and interactive uses.

6)When you run a terminal, it’s simply a window that runs bash in interactive
    mode, possibly reading some initialization code first.

7) It includes command line editing, key bindings, command history with unlimited size.

11)What are the Booting Steps of Linux OS ?

   1) BIOS :
                       a) BIOS Stands for Basic Input/output System.

                       b) Performs Some System Integrity Checks.

                       c) It is Present in ROM.

                       d) Searches, loads, and executes the boot loader program.

                       e) It looks for boot loader in floppy, cd-rom (or) hard drive.

                       f)Once the boot loader program is detected and loaded into the memory,
                          BIOS gives the control to it.               

  2) MBR:
                       a) MBR stands for Master Boot Record.

                       b) This MBR is located in the Starting Sector of the bootable device.

                       c) MBR is less than 512 bytes in size.

                       d)Windows --- NT Loader
                           Linux      --- LILO Loader

   3) GRUB:
                      a) GRUB stands for Grand Unified Boot Loader.

                      b) It Loads the OS from hardisk to RAM.

                      c)If you have Multiple kernel images installed on your system, you
                         Can choose which one to be executed.

                      d) It has the Knowledge of file system.

                      e) Universal Loader, Loader will Display.

  4) Kernel:
                      a) It will load the kernel from hardisk to RAM.

                      b) Kernel executes the init program.

                      c) All the services started Executed.

 5) Init:
                     a) Kernel will create the process.

                     b) Process Start running.

                     c) Process id is one.

                     d) Init will initiate Run Level Program (Minor Services).

6)Run Level Programs:
                     a)When the Linux System is booting up,you might see various services getting
                         Started.

                     b)Following are the available Run levels
                                    1) 0   -    Halt
                                    2) 1   -    Single User Mode
                                    3) 2   -    Multi User
                                    4) 3   -    Full Multi User Mode
                                    5) 4   -    Unused
                                    6) 5   -    X11
                                    7) 6   -    Reboot

12)What is LILO ?

 1) LILO is a boot loader for Linux.

 2)It is used to mainly to load the Linux Operating system into main memory
      So that it can begin its operations.

13)Explain about Kernel ?

     1)It is the core component of Operating  System, interacts directly
         With hardware, provides low level services to upper layer components.

      2) It is responsible for handling all system processes.

      3) All processes of memory and hardware initialization are carried out in kernel space.

      4) All the Services of the Operating System are called Kernel Services.

14)What are the types of kernel in Linux ?

The types of kernel in Linux are

  1)Monolithic Kernel

  2)Micro Kernel

  3)Hybrid Kernel

15)What are the components of  a Kernel ?

The Components of a Kernel are

 1)Process Management

 2)Device Management

 3)Memory Management

4)Interrupt Handler

5)Hardware Device Drivers

6)File system Drivers

7)Network Management

8)Synchronization and Communication

16)Difference between Process and Thread?

  a) Process is a program in execution.
      Thread means a segment of process.

   b) Process is a heavy weight process.
      Thread is a light weight process.

   c) The process takes more time to terminate.
      The thread takes less time to terminate.

   d) It takes more time for creation.
      It takes less time for creation.

   e) Process consumes more resources.
      Thread consumes fewer resources.

   f) The process is mostly isolated.
      Threads share memory.

   g) It does not share data.
      Threads share data with each other.

17)Difference between Semaphore and Mutex?

    a) Semaphore is used to synchronize between multiple processes.
         Mutex is used to synchronize between multiple threads.

    b) It is a type of signalling mechanism.
         It is a locking mechanism.

    c) Semaphore is just an integer variable.
        Mutex is just an object.

    d) Types of semaphore are counting semaphore and binary semaphore.
         Mutex has no subtypes.

    e) Semaphore value is modified using wait () and signal () operation.
         Mutex object is locked (or) unlocked.

18)What is Critical section of code?

  1)When more than one processes access a same code segment that segment is
       Known as Critical section.

  2)Critical Section contains shared variables (or) resources which are needed to
      be synchronized to maintain consistency of data variable.

19)What is Memory Management?

  Memory Management is the process of controlling and coordinating computer
  memory, assigning portions known as blocks to various running programs to
  Optimize the overall performance of the system.

20)What is Paging?

a)Paging is a memory management scheme that eliminates the need for
    Contiguous allocation of Physical memory.

 b)Paging is a storage mechanism that allows OS to retrieve processes from the
    Secondary storage into the main memory in the form of pages.

21)What are Frames?

   1)The Physical Address Space(Memory) is conceptually divided into a number of
        fixed size blocks called frames.

    2) Physical addresses are generated by Memory Management Unit.

Note: Logical address does not exist physically but Physical address does exist.

22)What are Pages?

1) The Logical Address Space is also splitted into fixed-size blocks called pages.

2) Logical addresses are generated by Central Processing Unit.

23)What is Page Fault?

 1)A Page Fault occurs when a program attempts to access a block of memory
    That  is not stored in the physical memory (or) RAM.

 2) Page Fault occurs when page is not in main memory.

24)What is meant by Buffer?

Memory area that stores data while they are transferred between two devices is called Buffer.

25)What is a Swap Space?

  1)Swap Space is a certain amount of space used by Linux to temporarily hold some
      Programs that are running concurrently. This happens when RAM does not have
      enough memory to hold all programs that are executing.

  2) Swap space management is done using virtual memory.
  26)What is IPC?What are the Various Schemes Available?

    1)Inter Process Communication is used to pass information between two (or)
         more processes.

     2)One process want to communicate with another process we need to follow
        IPC mechanism.

     3) Schemes are Pipes,FIFOs,Message Queue, Shared Memory, Semaphores.

27)What is deadlock?

     1)In an operating system, a deadlock is a situation which occurs when a process
         enters  a waiting state because a resource requested by it is being held by
         another waiting process, which in turn is waiting for another resource. If a
         process is unable to change its state indefinitely because the resources
         requested by it are being used by other waiting process, then the system
         is said to be in a deadlock.

   2)Process1 is locked R1 resource and waiting for R2 resource availability  where as
       Process2 locked R2 resource waiting for R1 resource availability. This situation is
        Called as Deadlock.

28)What is Real-Time use of Dead Lock ?

  1) Traffic Grid Lock is an everyday example of Dead Lock.

  2)When two trains are coming toward each other on same track and there is
      Only one track, none of the trains can move once they are in front of each other.

29)How to avoid Dead Lock ?

 We can Prevent Dead Lock by eliminating the below four conditions

   1)Mutual Exclusion

   2)Hold and Wait

   3)No Pre-emption

   4)Circular Wait

30)What is Cache memory?

  1)Cache Memory is used by the central processing unit of a computer to reduce the
       average time to access memory.

   2)The cache is a smaller, faster memory which stores copies of the data from the
        most frequently used main memory locations.

   3) As long as most memory accesses are cached memory locations, the average latency
        of memory accesses will be closer to the cache latency than to the latency of main
        memory.

31)What is Context Switching ?

1)Transferring the control from one process to other process requires saving the state
    Of the old process and loading the saved state for new process. This  is known as
    context switching.

 2) Loading and Unloading of PCBs is called context switching.

32)What is I-Node Number?

 Each file is given a unique name by the operating system which is called as the I-Node.

     1)An I-Node is an entry in the table, containing information about a file including :

        a)File Type,Permissions,UID,GID

        b)The Link count

        c)The File's Size and Various Time Stamps

        d)Pointers to the files data blocks on disk

        e)Other data about the file

33)What is Daemon?

 1) It is long lived. Often, a Daemon is created at system start-up and runs until the
      System is shutdown.

  2)It runs in the background and has no controlling terminal.So,some of the signals are
       ignored. (SIGINT, SIGSTOP, SIGHUP).

  3)The purpose of Daemons  are to handle periodic requests and then forward
       the requests to appropriate programs for execution.

34)What are the different types of Scheduling Policies?

   1)FIFO(First In First Out)/FCFS(First Come First Serve)

     2)Round Robin Scheduling

     3)SJF(Shortest Job First)

     4)Priority Based Scheduling

     5)Multi Level Feedback Queues Scheduling

     6)SRTF(Shortest Remaining Time First)

     7)LRTF(Longest Remaining Time First)

     8)Highest Response Ratio Next(HRRN)

     9)Multilevel Queue Scheduling

35)Explain FIFO Scheduling Algorithm?

     1) FIFO is also Known as FCFS.

      2) Simplest Scheduling Algorithm that Schedules according to arrival times of Processes.

      3) FIFO assigns the CPU based on order of Requests.

      4) FCFS is a Non-Pre-emptive Scheduling Algorithm.

      5) Non-Preemptive: A Process Keeps running on a CPU until it is blocked (or) terminated.

36)Explain Round-Robin Scheduling Algorithm?

      1) Round Robin Periodically releases the CPU from long-running Jobs.

      2) Based on timer interrupts so short jobs can get a fair share of CPU time.

      3)Preemptive:A process can be forced to leave its running state and replaced by
                             another running process.

      4)Time-Slice: Interval between Timer Interrupts

      5) If Time Slice is too long--Scheduling degrades to FIFO.

      6)If Time Slice is too short--Through Put suffers--Context Switching cost dominates

37)Difference between FCFS and Round Robin?

      1)FCFS not Suitable for Time Sharing Systems
         Round Robin Scheduling Suitable for Time Sharing Systems

      2)It is Non-Pre-emptive.
         It is Pre-emptive.

      3) It uses a FIFO Queue.
         It uses FIFO Circular Queue.

38)What is Multiprocessing ?

 Multiple applications running simultaneously  (or) concurrently are called as
 Multiprocessing.

39)What is Response Time?

  1)The Time gap between process is created and the first instruction of the process
      started executing that time gap is called Response Time.

  2)Response Time less is a good environment.

40)What is Starvation Time?

  1)The Process in its life cycle how much of time it is starvated without executing by
      the cpu that time is called as Starvation Time.

  2) Starvation Time less is a good environment.

41)What is Turn Around Time ?
   
  1)The Time gap between process creation to the process completion is called as
         Turn Around Time.

  2) Turn Around Time less is a good environment.

42)What is Through Put ?

 1) No of Processes completed per unit of Time is called as Through Put.

 2) Through Put more is a good environment.

43)What is Running State ?

 If a Process is executed by cpu then the process go to Running State.

44)What is Ready State ?
   
 If a Process is ready for execution but not executing by the cpu then the
 Process goes to Ready State.

45)What is Wait State ?

  If a Process is waiting for external event to finish then the process is treated as
  Wait State Process.

46)What is Delay State?

 If a Process intentionally goes to the delay using sleep function, then the process
 goes to Delayed State.

47)What is Suspend State ?

If a Process is Suspended because of some signal then the process go to Suspend state.

48)What is Orphan Process ?
     
If Parent Completes its Process before Child Process then Child becomes Orphan.

49)What is Zombie Process ?
   
  If Child Completes its Process before Parent Process then Child becomes Zombie
  (Dead Process).
         
50)Difference between Nice and ReNice ?

     1)Nice for modification of Scheduling Priority (or) Run a Program with modified
        Scheduling Priority (or) Create a Process with Modified Scheduling Priority.

     2)Re Nice for modification of Scheduling Priority of Running Process (or) is a
        Command to change the Priority of Running Process.

51)What is Scheduling ?

    It is a Method of Selecting the Sequence of the Process in Simple Words chooses the
    Process which has to be executed first in the CPU.

52)Explain about PCB ?

  1) PCB Stands for Process Control Block.

  2)A Process Operations are Controlled with the help of PCB can be considered as
      Brain of the process, which contains all the information regarding to a process
     Such as process id, priority, state, present working state and contents of CPU register.

 3)It is a Kernel based data structure which uses three kind of functions which
     are scheduling, Dispatching, Context save.

53)What is umask ?

    1)The user-file creation  mode mask (umask) is use to determine the file permission
          for newly created files.

     2) It can be used to control the default file permission for new files.

     3) It is a four digit octal number.

54)Difference between Hard Link and Soft Link ?

    1) Hard Link is the direct reference to the file.
        Soft Link is the reference by name which means it points to a file by file name.

    2) A file can be accessed through many different names known as Hard Link.
        A file can be accessed through different references pointing to that file is known
        as Soft Link.

    3)Command : ln filename1  filename2
        Command : ln -s  filename1 filename2

    4)Inode Numbers are same.
        Inode Numbers are Different.

    5) Both files are regular.
        One is Regular other is Link.

    6) If we delete the Original file we can get the data from the link file.
        If we delete the Original file we cannot get the data.

    7) File Size are same.
        File Size is different.



55)Difference between stat,fstat,lstat ?

  1) These functions return information about a file.

  2) All are system calls.

  3)Whenever the file name is a symbolic link, stat() returns the attributes (or)inode
      Information about the target file associated with the Link. Whereas the lstat()
      return the attributes of the  link.fstat() is identical to stat(),except that the file
      to be stat-ed is specified by the file descriptor.

  4) For stat () and lstat () if we give regular file it will give regular file information.
      For but stat() if we give link file it will give original file information but lstat()
      gives link file information.

56)Who is responsible for data transfer between Processes ?

 a) The Kernel is responsible for data transfer between Processes.

   b)The Kernel provides facilities such as 1)Signals

                                                                    2)PIPE

                                                                    3)FIFO

                                                                    4)Message Queue

                                                                    5)Shared Memory

                                                                    6)Semaphore

57)What is the Purpose of  IPC Mechanisms ?

  a)Data Transfer

  b)Sharing Data

  c)Event Notification

  d)Resource Sharing

  e)Process Control

58)Explain about PIPE ?

  a) Pipes Provide a Unidirectional Inter Process Communication Channel.

  b) It is Unstructured data stream.

  c) A pipe has a READ end and WRITE end.

  d) Data Written to the write end of a pipe can be read from the read end of the pipe.

  e)A pipe is created using a pipe(2) system call which contains a new pipe and returns
      two file descriptors, one referring to the read end of the pipe, the other referring to
      the write end.

  f)Pipe is used mainly for communication of related processes that means
     Communication between a parent and a child process.

  g)Pipes have a limited capacity, a pipe is simply a buffer maintained in
      Kernel   memory (65536).

59)What are the Disadvantages of PIPE ?

  a) They are half-duplex.

 b) Data flows in one direction.

 c) If multiple processes writes data the reader cannot determine the boundaries.

 d) If multiple readers are present a writer cannot direct data to specific reader.

60)Explain fork() system call ?

a) The fork system call is used to create a new process.

 b) The newly created process is the child process.

 c) The process which calls fork and creates a new process is the parent process.

 d) The child and parent processes executed concurrently.

 e) It is used for creating child processes for a parent process.

 f) Fork is called onces and returns twice.

 g)It will return 0 to the newly created process(child) and process  id of the child to the
    calling process(Parent)
 h) The child process gets copy of parent’s data, stack and heap segment. The code segment
     is common for both.

61)Explain about FIFO ?

a) FIFO is also called as Named Pipe.

 b)It is used for communication between unrelated processes

 c) FIFO stands for First in First Out.

 d)FIFO has a write end and a read end, and data is read from the pipe in the same order
     as it is written

 e)We can create a fifo file in two ways

    i)Through Command ii)Through Function

 f)mkfifo --Library Function
   mknod  -- system call

 g)Shell commands to pass data from one shell pipe to another without creating temporary
     files.

 h) By client server applications for sending data between clients and server.

62)What are Limitations of FIFO ?

a) When process writing data into FIFO, reading process must and should be available.

b) No addressing mechanism.

c)If multiple reading processes are there in that case when writing process writes the
    data there is no guarantee that who is going to receive it.

63)Explain about Message Queue ?


 a) Message queues can be used to pass messages between Processes.

 b) Message queue are a linked list of messages stored within the kernel.

 c) They are identified by a message queue Identifier.

 d) Message queues are somewhat like pipes, but differ in two important respects.

 e)First, message boundaries are preserved, so that readers and writers communicate in
    Units of messages, rather than via un delimited byte stream.

 f)Second, each message includes an integer type field, and it is possible to select
   messages by type, rather than reading them in the order in which they are written.

64)What are the functions used in Message Queue ?

a) msgget () is useful for creating as well as opening the existing message queue.

b)msgsnd() is useful for transferring the message into the message queue

c) msgrcv () is useful for receiving the message from message queue.

d) msgget () is useful for doing some control operations on the message queue.

65)What are disadvantages of Message Queue ?

a) It is called as Slowest IPC.

 b)Message queues are connectionless, and the kernel doesn't maintain a count of the
    number of processes referring to the queue as is done with pipes, FIFOs, and sockets.

66)Explain about Shared Memory ?

a) It allows two (or) more processes to share a given region of memory.

b) It is the Fastest IPC mechanism.

c) Semaphores are used to synchronize shared memory access.

67)What are the functions used in Shared Memory ?

a) shmget() is useful for creating as well as opening the shared memory segment.

b) shmat() is useful for attaching the shared memory segment to our process. so that
    Process can do the transactions.

c) shmdt () is useful for detaching the shared memory segments from our process.

d) shmctl() is useful for doing some control operations.

68)What is PID ?

a) PID is process id.

b)The process manager recognises processes by an identification numbers and not with
   names, this process identification number is called PID of a process.

c)A process is an executing instance of a program

d) Each process is guaranteed a unique PID, which is always a non negative integer.

69)What do you meant by Multi Threading ?

 1)Multi Threading is Multi Tasking, but enables the processing of multiple threads at
     One time, rather than multiple processes.

2)For Example, a Multi Threaded Operating system may run several background
     tasks, such as logging file changes, indexing data and managing windows at
     Same time.

70)What are drawbacks of Threading ?

 1) Complex Debugging and Testing Processes.

  2) Result is sometimes Unpredictable.

  3)Overhead Switching of context

  4) Increased Potential for deadlock occurrence.

  5) Increased Difficulty level in writing a program.

71)Difference between getpid() and getppid() in Linux ?

Both getpid() and getppid() are inbuilt functions of unistd.h library

1)Syntax : a)pid_t  getpid(void);
                   b)pid_t getppid(void);

2) a) It will give the process id.
    b) It will give its parent process id.

3) Returns the PID of the calling process.
    Returns the PID of the parent of the calling process.

72)Difference between signal() and sigaction() in Linux ?

 Both are system calls

1) Signal returns the previous signal disposition on success.
     Sigaction changes the disposition of a signal.

2)signal() function is simple
   Sigaction() function is complex

73)What are the File Permissions in Linux ?

 Permissions are associated with every file, and are useful for security.

 1)There are three categories of users:

       a)User (U)
   
       b)Group (G)

       c)Others (O)

2)There are three types of  access permissions:

       a)Read (R)

       b) Write (W)

       c)Execute (E)

74)Explain Process Management System calls in Linux ?

  The system calls to manage the process  are :

  1) fork (): used to create a new process.

  2)exec() :Execute a new program

  3)wait() :Wait until the process finish execution

  4)exit(): Exit from the process

And system calls used to get process ID are :

 1) getpid ()   : get the unique process id of the process.

 2) getppid (): get the parent process unique id.

75)What are the Linux commands you Know ?

pwd  - print working directory

The command is used to print the name of the current working directory.

cd     - change directory

The command changes directories to specified directory

ls  -  list the files

The command lists the directory contents

cat

The command is used for displaying and create files


rm

The command is used to delete files
  
mv

          
The command is used to rename file (or) group of files as well as directories.

wc

The command counts lines, words, and character depending on option.

mkdir

The command creates a directory

rmdir

The command removes a directory.

cp

         
The command copies information from one file to another.


head

The command will display the first 10 lines of a line.


tail

The command will display the last 10 of a file.


ps

The command displays the current process status of the system.



77)What is Virtual memory ?

1) Virtual Memory is a feature of an operating system.
 2)If the RAM falls short of memory to accommodate more running processes
    the OS allocates a portion of your hard drive is referred as Virtual Memory.

78)What is meant by Major and Minor numbers in Linux ?

1) Every Device in Linux is represented as a regular file.
 2) These files are called Device files.
 3) Each device file in Linux has two unique number associated with it.
 4) These two numbers are Major and Minor Numbers.
 5) Major Number is a Unique Number which Specifies a Particular driver.
 6)Every Device Driver has their unique major number which helps kernel
    to identify the driver.
 7)To differentiate between the devices, every device in  Linux  system provided
     a unique number is called minor number.
8) We can say that Minor number represents a device and major number specify a driver.      

79)What is meant by TOP Command in Linux ?

1) TOP Command is used to show the Linux Processes.
 2) It provides a dynamic real time view of the running system.
 3)Normally, this command shows the summary information of the system and
   The list of processes (or) threads which are currently managed by the Kernel.


80)What are the five default kernel actions for any signal ?

a) Terminate the Process.
b) Ignore the Signal.
c) Suspend the Process.
d) Write the execution context and the contents of the address space in a file and   terminate the process.
e) Resume the Process execution, If it was stopped.




81)Explain the following signals ?
 
     a)kill( )
     b)pause( )
     c)raise( )
     d)alarm( )

a)kill()
   i) To send signals from one process to other process you can use a system call kill ().
  ii) #include<signal.h>  int kill(pid_t pid ,int sig)
iii) Returns 0 on success, Returns -1 on error.
b)pause()
 i) You can make process to sleep till any signal arrives by using a system call pause ().
ii)#include<unistd.h>    int pause(void)
iii) Using pause () a process can suspend execution until a signal arrives.
c)raise()
i)You can send signal to the same process by calling a library function raise().
ii)#include<signal.h>   int raise(int sig)
iii) Returns 0 on success, Returns non zero on error.
d)alarm()
i)The system call alarm() arranges for SIGALRM Signal to be delivered to calling process after specified seconds in the argument.
ii)#include<stdio.h> unsigned int  alarm(unsigned int seconds)
iii)alarm() will not block the process.
iv)It returns the number of seconds remaining until any previously scheduled alarm was due to delivered,(Or) zero if there was no previously scheduled alarm.


82)Which signal is generated when we press Ctrl Z ?

The SIGSTOP Signal is sent to a process by its controlling terminal to request it to stop (or) it is used to suspend a process by sending it the SIGSTOP which is like a sleep signal that can be undone and the process can be resumed again.




83)Which signal is generated when we press Ctrl C ?

It sends an INT Signal (SIGINT) by default, this causes the process to terminate.