Command-Line Processes – Do All Programs Need Shell Access?

bashcommand lineguikernel

I have seen somewhere that "bash is used to communicate with the Linux kernel."

Is it applicable only to the terminal? Or does every program (including programs which has GUIs) have to go through the shell to complete the process they willing to make?

(Consider we are coloring a photo. How does bash know what we are doing? Is there a third party between gimp and bash to convert them to bash?)

It would be really helpful if can you take an example to explain 🙂

Best Answer

Nope. Only users have to go through a shell to communicate with the Kernel. Applications use APIs.

For example, if I want to delete a file, I have to use one shell or the other, and then an application to delete the file:

  1. With a Command-Line Interface (CLI) shell, such as bash, I can use the rm command to delete the file.
  2. With a GUI shell (like Unity, or GNOME Shell), I can use something else, such as the File Manager to delete the file. The GUI shell does not, in turn, need to use a CLI shell.

Both the File Manager and rm in turn may use the unlink(3) (or the higher level remove(3)) function (or system call) to do the actual work.