How shell commands work.

·

1 min read

We are going to learn how shell commands work.

Shell is a program/software that takes user input and passes it to the operating system.

Terminal program is a GUI that interacts with the shell.

In Linux, we have files and processes. ls is a file that when it gets executed, a process is created with a unique number called PID, which is further used by system calls to manage these processes.

Shell searches for the command at locations given by the PATH environment variable.

After searching, it finds the ls file at the /bin location.

Now shell executes the ls program and creates a child for the current shell process that acts as the parent of the command.