Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I usually open lxterminal with bash shell where I usually type tmux command first.

I'd like to have launched tmux command automatically, so I tried to add this command to ~/.bash_profile or to ~/.profile files but none of them launched the tmux automatically.

Can this be achieved?

share|improve this question
1  
Launch lxterm -e tmux instead? –  Ulrich Dangel May 26 '12 at 12:59
    
It's lxterminal. When I run lxterminal -e tmux, alias in ~/.bash_aliases for tmux is not applied and it has no advantage, I still would have to type tmux instead of being launched automatically after bash. –  xralf May 26 '12 at 13:05
    
sorry i assumed lxterm equals lxterminal. The normal solution is to change this in your window manager and automatically launch it when you start a terminal –  Ulrich Dangel May 26 '12 at 13:13
add comment

2 Answers

up vote 1 down vote accepted

It's really not recommended to do what you wanted , usually I place something similar for ttyX , edit yor bashrc , add the following lines , which will allow any XTERM based terminal to launch tmux on start.

[[ $TERM = "xterm" ]] && { tmux && exit 0; }

You should add a new shortcut or launch terminal with custom shell , which is tmux. ( not sure if lxterm support this )

share|improve this answer
    
This starts tmux whenever you run bash in an X terminal. That's very invasive: it means you can never run an interactive shell in an X terminal outside tmux. –  Gilles May 28 '12 at 1:05
add comment

Change your menu entries, keybindings, shell aliases, or whatever you use to run Lxterminal to run lxterminal --command tmux.

Adding tmux to ~/.profile or ~/.bash_profile is no good: these files are read only when you log in. Adding tmux to ~/.bashrc is no good either: that would start tmux in any instance of bash, not just the ones started by lxterminal.

share|improve this answer
    
I usually start lxterminal via dmenu launcher, I'm not sure if it supports some aliases. –  xralf May 28 '12 at 14:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.