Find out what scripts are being run by bash on startup
If your system has strace
then you can list the files opened by the shell, for example using
echo exit | strace bash -li |& grep '^open'
(-li
means login shell interactive; use only -i
for an interactive non-login shell.)
This will show a list of files which the shell opened or tried to open. On my system, they are as follows:
/etc/profile
/etc/profile.d/*
(various scripts in/etc/profile.d/
)/home/<username>/.bash_profile
(this fails, I have no such file)/home/<username>/.bash_login
(this fails, I have no such file)/home/<username>/.profile
/home/<username>/.bashrc
/home/<username>/.bash_history
(history of command lines; this is not a script)/usr/share/bash-completion/bash_completion
/etc/bash_completion.d/*
(various scripts providing autocompletion functionality)/etc/inputrc
(defines key bindings; this is not a script)
Use man strace
for more information.
Reviving this question because strace
is an overkill here.
Execute bash and carve it out of the output. -li
is login interactively, -x
prints out what bash is doing internally, and -c exit
tells bash to terminate immediately. Using sed
to filter out the source
command printout.
/bin/bash -lixc exit 2>&1 | sed -n 's/^+* source //p'