saintlyRook
saintlyRook

Reputation: 495

How does bash get commands into the operating system?

If I understand correctly, bash is just another user-land program.

So when I type:

ls -la

or

mv myfile.txt myotherfile.txt

how does bash feed these commands into the operating system kernel? Is this something to do with POSIX?

Upvotes: 1

Views: 98

Answers (1)

marbu
marbu

Reputation: 2021

Well, unless the command you enter into the command prompt is a bash builtin (such as cd, alias or echo[1]) the shell will create a new process (using fork(2) syscall) and execute the program via the exec system call.

[1] you can run type something to find out if something is a shell builtin

Upvotes: 9

Related Questions