We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Petro • 8 years ago

RE: .bashrc/.bash_profile.

tmux is starting *bash* as a login shell, and that's why it doesn't read .bashrc. From the bash man page:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

[...] When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.

Most of the time there is a default stanza in your bash_profile that looks like this:

if [ -f "${HOME}/.bashrc" ] ; then
source "${HOME}/.bashrc"
fi
(cygwin)

Or:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
(Redhat/Centos/etc.)

Note that I personally don't like using . for "source" as it's easy to miss and *REALLY* harder to grep for (only by a little, but still).

Anyway, thanks for the tutorial.

consumer shi • 5 years ago

Not sure if anyone's seen https://unix.stackexchange....

Still have no way of having 2 terminal windows displaying different tmux windows?

M Maier • 5 years ago

Where is tmux better than GNU Screen?
I am currently used to GNU Screen. Tmux "looks" better by default. But I am missing a major advantage. Anyone uses GNU Screen too or instead of tmux? GNU Screen is in most situations already available. tmux needs to be added extra.

Jeňa Kočí • 4 years ago

I used both and for me it's the split-screen feature in tmux that won me over. I recall screen can do it in some hackish way, but tmux just has it nice and working out of the box. Otherwise I don't see much difference between them.

Btw tmux can be installed without root (e.g. on HPCs) with conda package manager.

Max Z • 5 years ago

All good except I'd recommend tilix now. Terminator is written in Python and once you have a couple long-running windows, the performance starts to deteriorate due to memory leaks I gues.

Richard Fojta • 6 years ago

set-option -g mouse on

that is working now

Marcin Zablocki • 7 years ago

Really, really helpful! Especially the shortcuts section, thanks!

lebucur • 7 years ago

Very well written article.
I had problems with mouse select pane option, though.
Cheers!

pi • 7 years ago

Where is the command to quit it? That should be the second command in a tutorial. How do I get in? How do I get out?

Łukasz Wróbel • 7 years ago

I’ve extended the tutorial with information on starting and quitting tmux.

Web Hosting • 8 years ago

In the former case I'll usually end up helping them installing tmux on their machine and will give them a 10 minute guide to learn the most important basics.

wilgoszpl • 9 years ago

Thanks for that! I used it to prepare insane shell-config to auto run project-specific environments.

This can be nice addition to you project. The [article I wrote](http://blog.wilgosz.pl/post... is in Polish language however here you can get the github config for [the terminal and tmux settings](https://github.com/wilgoszp....

your_name • 10 years ago

BTW: new windows in tmux start a login shell, so .bashrc won't be read by default

Nilesh • 10 years ago

Awesome tutorial. I wasn't using any advanced features of tmux now I want to!

Oh also this captcha you have has very poor visibility on mobile (chrome android). It took me 3 attempts to actually decipher it.

Shawn B • 10 years ago

Great page and very useful information. I'm using tmux with multiple screens intilda and loving it, thank you.

Peter • 10 years ago

Great little tutorial with pros and cons clearly explained. Eventhough I will most probably still stand with the terminator I certainly give tmux a go in the future.

Jeňa Kočí • 4 years ago

I agree that locally Terminator / Tilix is more convenient, however I use Tmux on servers (HPCs) to have split-screens, as tmux opens the connected server on new pane, while Tilix opens localhost in new pane.

Ganapathi K • 11 years ago

I landed on your write up on tmux after going through lot of sites. Your document is simple
and practical. It is really great.

-Ganapathi, Chennai,India

Nikos • 11 years ago

*Great* article..
Thanks for showing this amazing tool to us!

Rick • 11 years ago

I tried the first 3 lines in .tmux/dev

selectp -t 0 # select the first (0) pane
splitw -h -p 50 # split it into two halves
selectp -t 1 # select the new, second (1) pane

It splits the terminal into 2 vertical panes. Isn't -h suppose to split it into horizontal panes?

Łukasz Wróbel • 11 years ago

**@Rick:** The commands you provided work as they're supposed to. The problem is in the tmux naming convention, which we both (and not only we) seem to find counterintuitive.

Take a look at these examples:

* http://ebeab.com/2012/07/27... :
> bind | splitw -h -p 50
>
> bind - splitw -v -p 50

* http://blog.hawkhost.com/20... :
> bind | split-window -h
>
> bind – split-window -v

* http://amjith.blogspot.com/... :
> splitw -h -p 50 'bpython' # Split pane 0 vertically by 50%
>
> splitw -v -p 25 # Split pane 1 horizontally by 25%

rtmie • 11 years ago

Really nice step by step intro. Thanks.

Stasiek • 11 years ago

i3 >> AwesomeWM

asdfasdf • 11 years ago

thanks! for using `screen' as a reference. It helps me migrate to tmux

Johan Krafft • 11 years ago

Thanks for a great tutorial. I'm diving into Linux, and tmux has made my experience in the OS a lot smoother :) Thank you!

Gary Ferguson • 11 years ago

As mentioned earlier **Tmuxinator** is a great way to set up tmuxinator for different projects.

The two combined make a great tool.

Joseph Rex • 11 years ago

I feel really reluctant reading man pages. Your article made it all really clear to me and I started using Tmux from this moment. Thanks for the great article!

Jerzy Nowakowski • 11 years ago

C-a is jump-to beginning of the line command
Binding this way the command is blocked
I used C-x instead.

Thanks for a great tutorial

Jeňa Kočí • 4 years ago

C-a is jump-to beginning of the line command

In what editor? At least my shell doesn't do that. And C-a is used by gnu-screen already, so any conflict would show up there too..

Jimmy • 11 years ago

@globetrotterdk: I get almost precisely the same error, "(0) /dev/pts/0: 7 [80x24 xterm] (utf8)" I'm in Ubuntu 12.10, and the error occurs even with an empty script file. Did you solve your problem?

Rohit Nair • 11 years ago

Thank you, this article saved a lot of time for me.

Parakram Majumdar • 12 years ago

Very nice article; I would say it's better than most others in terms of readability. But can you also include a more exhaustive cheat sheet? "How to rename window" is what i was looking for, but couldn't locate.

Łukasz Wróbel • 12 years ago

**@Parakram**: I'd like to keep this article simple, though providing a separate, more detailed cheat sheet sounds like a good idea.

To rename a window in tmux, type in `Ctrl+b` and press the "," key (comma). Then hold backspace to erase the old name, provide a name of your own and confirm it by pressing Enter.

Yann • 12 years ago

Thanks for your post. This is the first one that made me change my mind. Clearly tmux used that way fit my needs.

ranska • 12 years ago

Pretty usefull i will take a look at:
wemux.
thank's

Raj • 12 years ago

Great post, I was using screen all these years and discovered tmux today when searching for vertical split support. This article just got me started easily. Thanks!

ray • 12 years ago

Thanks for the tutorial. I'm looking for some way of having multiple terminals that can share the same environment variables in real time. Can tmux do that? Till now, I just start multiple xterms but if I set a variable in one, it's invisible in the others. Perhaps tmux can solve that?

Thanks.

Łukasz Wróbel • 12 years ago

**@ray:** Honestly, I don't see any simple way of achieving this. What's more, answers to this question:

http://unix.stackexchange.c...

dont' cheer me.

northcamel • 13 years ago

Thank you for sharing tmux~

Walter Yu • 13 years ago

Great write-up! The .term.conf file example was helpful, I now have it running in my home directory with multiple panes. w00t!

Shfx • 13 years ago

Take a look at [tmuxinator](https://github.com/aziz/tmu.... It's quite nice when you want to work with projects that use different split panels.

Also, working with shared session with [wemux](https://github.com/zolrath/... :)

Ben • 13 years ago

I second felix on Awesome WM. It works great for maximizing screen space and keeping multiple windows open and quickly accessible. There was recently a member of the mailing list that recommended tmux for a terminal with Awesome and it sounded like a great combo.

Felix • 13 years ago

I strongly advise you to take a look at the awesome windowmanager (http://awesome.naquadah.org/). Of course, it is yet another tool for a yet different task, but it goes along the features and philosphy you seem to like.

Łukasz Wróbel • 13 years ago

Thanks Felix, awesome window manager seems to represent a higher level concept. It doesn't try to organize space inside windows of one type only, but it organizes windows of all types instead.

Some programs (incl. e-mail clients, at least for me) are hardly replaceable with console tools, which makes awesome window manager even more hopeful. I wonder if combining awesome with software like tmux would prove its worth.

globetrotterdk • 13 years ago

Hi Lukasz, great posting. I used your scripting example on my laptop and it worked just fine. However, when I initiate the scriptt on my desktop machine, I get the following error:

(0) /dev/pts/2: 6 [190x30 xterm] (utf8)

Any idea what that is about?

I am using Lubuntu 12.04 on my laptop, and Ubuntu 12.04 on my home built desktop computer. In both instances, I am using Guake as my default terminal app.

Łukasz Wróbel • 13 years ago

**@globetrotterdk**: I'm currently using Ubuntu 11.10 and tmux scripts run without any hassle. I even tried to run them from within Guake and didn't notice any difference.

To hunt the bug, I would try to eliminate all the noise. Begin with switching to text terminal by pressing `Ctrl+Alt+F1`, then enable tmux. If the script fails, try to eliminate its content line by line to find which line causes the trouble.

However, if the script works under the text terminal, switch back to the graphical environment. If the script works under the default terminal-handling program, try using Guake etc.

I don't know any possible cause of an error message like the one you've provided me with, you must at least try to narrow the search.