Artificial intelligent assistant

How exactly do programs or bash shell commands work on Linux systems? I am researching how processes and shell work in Linux system. I would like to consult you to see if my conclusions are correct. When we start the system, the kernel starts the init process, everything else is run as a sub-process with the fork of this process. For example, when I run any program, the parent process is forked for this program and then the forked process becomes the child process(or sub-process) that runs the program with exec. If this is the case, for example, when I run the bash shell, the parent process forked and exec makes the forked process the child process the bash program will run on. At this point, what stumbles upon me is how the commands we enter into the bash shell are executed. How do the built-in and external commands go through? For example, do built-in commands fork or create subprocesses for them?

What you are asking will be true for all Unixes, not just Gnu/Linux.

The thing to note is that after a `fork`, one does not need to exec. So for shell built-ins the shell will fork, and then do the built-in command.

The shell will also fork for a sub-shell. The shell does not fork when it does not have to: e.g. for simple commands that are built in. Where simple includes not in a pipeline.

There is also (not mentioned in your question) the pipes. These are created before the fork, but wired up after the `fork`, and before the, optional(see built-ins), `exec`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy afce08275b527026eac46b05c2405176