tmux multiple terminals

I think most of us watched the movie Inception in which there was dream within a dream. It was a bit of confusing at some point. There is a Linux version of it 🙂 terminal within terminal provided by the fantastic tool tmux (terminal multiplexer). I use this tool during some troubleshooting scenarios when I would like to see two continuous pings on two terminals. Sometimes, I also divide the screen to 4 terminals. It may not be needed for everyone but in my opinion it is really handy. Here is an example of what you can achieve by tmux on a single terminal.

tmux-screenshot

It is pretty cool right.

Once you install tmux via “yum install tmux” or “apt-get install tmux” just type tmux after you will get a single screen like this;

tmux1

So you are tmux ready now. On tmux, any operational command should start with “CTRL+b” keys so now we will split this screen to two horizontally. For this press “CTRL+b” and then double quotes and here what we get after that;

tmux2

Now your cursor should be on the lower virtual terminal. In there, if you press “CTRL+b” and “%”, then you will create a horizontal screen like below;

tmux3

Once you are in there, if you press arrow keys right after “CTRL+b”, you will be moving between the virtual terminals. Once you move up, you can also create the forth terminal.

In short;

  • tmux : instantiate the tmux session
  • ” : double quotes creates a vertical screen
  • % : creates a horizontal screen
  • x : kills the pane
  • c : create a new window
  • , : rename current window
  • 0..9 : select window by number
  • Arrow keys : moves the cursor between the virtual terminals
  • if you press arrow key constantly on a single window (by holding CTRL+b at the same time), it changes the width/height of the terminal

There is a lot more to this actually. I just wanted to show a visual demonstration. For more details you can visit cheatsheet site for more at https://tmuxcheatsheet.com/

You have a feedback?