On my Ubuntu server I run tmux. When I login on the server itself I get tmux, when I login with SSH I get tmux too.
Right after a reboot logging in on the server starts tmux within seconds and when logging in with SSH it starts within seconds too.
After a few weeks and login attempts both locally and remote, logging in with SSH still starts tmux within seconds while with logging in locally on the server tmux starts slower and slower. I've experienced delays of over 20 minutes before tmux appears.
I don't know what's wrong but somehow it seems to be server related. How can I solve this? There are no errormessages regarding tmux.

  • Are you logging or auditing everything? Does your terminal have the history set to infinite? Dec 3, 2015 at 23:46
  • I'm logging things that the server is logging by default so I didn't add additional things to log. The history is set to a value substantially larger than the default but it isn't set to infinite.
    – wie5Ooma
    Dec 3, 2015 at 23:51
  • Running a strace and valgrind on tmux might provide additional insight. Some basic performance stats like vmstat and friends would help as well. Reproducing with a standard / clean config and the latest stable / latest snapshot version respectively would also help narrow it down. Of course - you may need to speed up the process (ex: automate a bunch of attach / detach operations and see if there's a change in the footprint). Dec 4, 2015 at 4:01
  • Is it just tmux that loads/runs slowly? Also, when you say "when I login on the server itself I get tmux, when I login with SSH I get tmux too", what do you mean? Do you have something that's launching tmux automatically in your bashrc (attaching sessions recursively)? What else is running? Is your server a VM? Do you have sar running - it can tell you how much memory is in use, etc.
    – Liczyrzepa
    Dec 4, 2015 at 13:51
  • @Liczyrzepa Tmux starts automatically when I log in to the server whether it is over SSH or physically on the server itself. It is a real server and not a VM. The server is running multiple other processen like a webserver. Limited available memory might be an issue.
    – wie5Ooma
    Dec 5, 2015 at 23:12

2 Answers 2


For me, that was a problem with the following line in my .zprofile:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/gbajson/.zprofile

After a few weeks I had over 700 following lines in .zprofile, so the starts were slower and slower.

gbajson@misio:~$ grep -c "/home/linuxbrew/.linuxbrew/bin/brew shellenv" .zprofile
  • I had a line in /etc/profile.d/ that ended up filling my .bashrc with over 26000 lines! Thanks for this answer! Jul 1 at 17:54

If you are detaching or doing a hard disconnect (something like closing the terminal emulator) from the session when you are finished and running simply tmux every time you connect, then you are creating a new session every time. Make sure you use something like tmux a || tmux when you login/connect.

You must log in to answer this question.

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