strace sends its output to stderr by default.
Here, you could do:
strace -o >(grep --color open >&2) zsh
To run zsh while seeing all system calls that have open anywhere in the name or arguments or return value or:
strace -e /open zsh
(short for strace -e trace=/open zsh) or:
To see the system calls that have open in their name (such as open, openat, pidfd_open, mq_open, open_by_handle_at, perf_event_open list might not be accurate depending on what system and version thereof you're on).
Or:
strace -e open,openat zsh
For only those two system calls.
That output goes to the terminal along with the shell's prompt and command outputs. You may prefer to send it to a file that you can inspect later on or live in a separate terminal or screen/tmux pane:
strace -o >(grep --color open > strace.log) zsh
strace -e /open -o strace.log zsh
To also strace calls made in child processes (including by commands executed there and their children), you'd need the -f option.
So see what opens your ~/.xinitrc (which has nothing to do with zsh) and when, you can use the audit system (may not be installed/enabled by default on your system).
stracetovim? See my answer there. I think-owill help you. – Kamil Maciorowski Mar 08 '23 at 12:24strace. It has options to limit the output to selected calls, e.g.strace -e trace=openor ...-e trace=file– Bodo Mar 08 '23 at 12:24strace zsh -e trace=openbut it also outputs some other stuff and I can't see any.zprofile,.zshrcin output, so does it also manipulate execution flow of a process? – Visrut Mar 08 '23 at 12:42strace -e trace=open -o output.txt zsh– Bodo Mar 08 '23 at 12:49--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=276345, si_uid=1002, si_status=0, si_utime=0, si_stime=0} --- --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=276346, si_uid=1002, si_status=0, si_utime=0, si_stime=0} ---– Visrut Mar 08 '23 at 12:51xinitrchas nothing to do with zsh, that's a config file forxinit, notzsh. – Stéphane Chazelas Mar 08 '23 at 12:51openyou might have to specify options tozshbecause not all files will be used in all situations, e.g. only for login shells or interactive shells, or the shell might have used other calls to check if the file is present before it would callopen.-e trace=filewill trace all calls that contain a filename. – Bodo Mar 08 '23 at 13:05