I use bash on Ubuntu 18.04. I have added a lot of functions and a lot of scripts are sourced in my bashrc. I am able to time the total time it takes to load my terminal, sometimes it takes 0.9 seconds to more than a minute. And this happens randomly, not that only at the first time it takes more time.
How can I log and analyze how much time each command in bashrc takes to execute. I hope that the logs are generated every time automatically and when it is slow I could analyse the cause of it.
Any suggestions as to what can be done.
Secondly, would preload daemon be useful to speedup the loading of the terminal. I am not sure about it.
time
to time commands eg.time source ./somefuncsA.bash
– X Tian Feb 28 '19 at 14:00