What is the difference between Shell, Kernel and API What is the difference between Shell, Kernel and API shell shell

What is the difference between Shell, Kernel and API


  • A command-line interface (CLI) shell is a command interpreter, i.e. the program that either processes the command you enter in your command line (aka terminal) or processes shell scripts (text files containing commands) (batch mode). In early Unix times, it used to be the unique way for users to interact with their machines. Nowadays, graphical user interfaces (GUIs) are becoming the preferred type of shell for most users.

  • A kernel is a low level program interfacing with the hardware (CPU, RAM, disks, network, ...) on top of which applications are running. It is the lowest level program running on computers although with virtualization you can have multiple kernels running on top of virtual machines which themselves run on top of another operating system.

  • An API is a generic term defining the interface developers have to use when writing code using libraries and a programming language. Kernels have no APIs as they are not libraries. They do have an ABI, which, beyond other things, define how do applications interact with them through system calls. Unix application developers use the standard C library (eg: libc, glibc) to build ABI compliant binaries. printf(3) and fopen(3) are not wrappers to system calls but (g)libc standard facilities. The low level system calls they eventually use are write(2) and open(2) and possibly others like brk, mmap. The number in parentheses is a convention to tell in what manual the command is to be found.

The first volume of the Unix manual pages contains the shell commands.

The second one contains the system call wrappers like write and open. They form the interface to the kernel.

The third one contains the standard library (including the Unix standard API) functions (excluding system calls) like fopen and printf. These are not wrappers to specific system calls but just code using system calls when required.


The Shell is the way to communicate with the OS and kernel by command line. The Shell does this by also calling the API. The kernel is indeed the core of the OS and does memory management, task scheduling, handles with filesystems, I/O handling,...All the things that the kernel does, can in some way be invoced by the API the OS provides.

printf and fopen are wraps around the system calls (API) provided by the OS and kernel


Shell: It is like a command line interface to your operating system. Commands like ls, ps, kill and many more can be used to request to complete the specific operation to the OS. It is like "cmd" on windows.

Kernel: It is the main code of any operating system. Any request you give on shell or through GUI (like memory allocation, opening a file etc) are finally fulfilled by Kernel.

And yes, the calls you mentioned are regarded as API calls. The request to these calls are also handled by Kernel. Please go the below link to find API calls in unix.http://www.mkssoftware.com/docs/api_index.asp

This is the overall picture in a unix os:

Applications => (shell+library routines) => system calls => kernel

look the final request handler is the Kernel.Thx!