I've been studying UNIX and system calls and I came across a low-level and tricky questions. The question asks what system calls are called for this command:
grep word1 word2 > file.txt
I did some research and I was unable to find a huge number of resources on the underlying UNIX calls.
However, it seems to me that the answer would be
open (to open and the file descriptor for the file
dup2 (to change the
grep to the file descriptor of
write to write the
grep (which is now the file descriptor of
file.txt), and finally
close(), to close the file descriptor of
However, I have no idea if I am right or on the correct path, can anyone with experience in UNIX enlighten me on this topic?