25

Opening my terminal (ctrl+alt+t), it takes a long time to load my prompt. I had read here regarding the same issue but none of their solutions helped me. On opening the terminal, it takes around 4-5 seconds to load and just before the prompt appears, I see a really quick flash of a white splash-screen sort of program popping up. I don't think that this has happened after installing any particular package/software. Any suggestions?

Thanks in advance.

1

2 Answers 2

34

To see every command that runs during your shell's startup configuration, put

set -x

at the top and

set +x

at the bottom of both files ~/.profile and ~/.bashrc.

(Keep your text editor open so you can undo these changes easily!)

Then in a terminal, run:

$ bash --login

and see which command takes the most time.

11
  • I may be super stupid but I cannot figure out how this works. I added those lines but nothing changed at all. Nov 16, 2016 at 20:57
  • @UpmostScarab After adding the lines, type bash --login in a terminal, and see what happens. (Press Ctrl-D afterwards to exit the shell you just started.) Nov 17, 2016 at 1:31
  • Thanks. Turns out that my terminal was suppressing the output. Nov 17, 2016 at 6:49
  • 3
    Thanks SDKMAN! for slowing down my work.
    – mjaggard
    Feb 22, 2017 at 8:36
  • 2
    same for me... was SDKMAN (sdkman.io)... timeout connection was causing the shell to take over 10s to load T_T
    – daveoncode
    Sep 22, 2017 at 9:48
0

I had a really peculiar example, that I want to share with you. Namely, I had this command in my .profile and .bash_profile file:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init -)"' >> ~/.profile

and in .bashrc file:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

that I pasted in my config files instead of in my shell.

Therefore, each time I logged in to my shell, it appended new instructions to the config files, creating this infinitely increasing loop of new, useless instructions.

Hopefully, my silly wrong copy-and-pasting story may gave you a little smile :D

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .