I recently updated my Ubuntu 14 system and the update has made it impossible to have tmux started up automatically. In fact the previous setting made it impossible to log into my Ubuntu account(!), but luckily I had another admin account that I could use to log in and fix the login (comment out the line in my .bashrc). Whew. But the tmux not on startup issues remained.

The problem is:

I've had this at the bottom of my .bashrc for some time:

[ -z "$TMUX" ] && command -v tmux > /dev/null && TERM=xterm-256color && exec tmux

and that worked for years on both Ubuntu and OSX.

Recently it stopped working on Ubuntu

I tried using

[ $TERM != "screen" ] && TERM=xterm-256color && exec tmux

instead but got the same problem and can't even log in.

fyi: the problem goes away once logged in, you have to actually log out and in to test changes. I ended up switching several times between my two accounts to test changes to my .bashrc (I su'd to my account in a terminal in the other login to be the other user and have permissions to do that.

I suspect the problem is with the exec tmux. I can change those references to just be tmux and this partially fixes the problem but now requires me to exit twice when quitting any terminal window which is annoying.

1 Answer 1


My answer to this was to do 2 things:

First have the .bashrc line use this so that it works on OSX:

[ `uname -s` != Linux ] && exec tmux

Secondly, for Ubuntu, change the terminal profile to use tmux directly, e.g.

on enter image description here

check the custom command enter tmux, e.g.

enter image description here

For quake I also had to update preferences (right click while using it -> preferences)

Changing the shell from /bin/bash

enter image description here

to /usr/bin/tmux, i.e. enter image description here

You must log in to answer this question.

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