Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Organize your terminal using tmux panes

    Bonnie EisenmanBonnie Eisenman

    Learn to organize your workspace using tmux. We'll create a new tmux session and learn how to create and navigate panes within a tmux window.

    We'll cover:

    • How to create new panes via vertical splits with C-b %
    • How to create new panes via horizontal splits with C-b "
    • Navigating between panes with C-b and arrow keys
    • Closing panes with exit or Ctrl-d
    • Viewing available commands with C-b ?
    tmuxtmux
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:00 You can either install tmux from the project's website at tmux.github.io or you can use your package manager of choice. I'm on Mac OS X, so I installed tmux with brew install tmux. To start tmux, we type tmux. Now you'll notice while I'm recording here that I have a keystroke logger active on the bottom left-hand corner of my screen to mirror whatever it is I'm typing.

    00:20 I'm going to type tmux and then return. Now I'm in a tmux session. You can see that we have what looks like a normal terminal window as well as the screen status bar on the bottom. It tells me what number session I'm in, that I'm running bash. It also gives me some extra information here, like the date and the time.

    00:37 Tmux is really useful for organizing your workspace. One of the most common ways of doing that is with panes. I'm going to create a new pane by pressing Ctrl-b and then the percentage sign. As you can see, now I have a split screen. I have a left pane and a right pane.

    00:53 In order to navigate between these two panes, I can type Ctrl-b and then an arrow key. You can see that which pane is highlighted changes. I use Ctrl-b because it's my prefix key. Every tmux command is going to be prefixed with Ctrl-b.

    01:07 If I want to make a split in the other direction, I do Ctrl-b and then the double quote key. Now you can see that I have yet another pane here. Each of these terminal windows works independently.

    01:18 Let's say that I want to look up fgrep man page in this window. I can do that. Then I can switch over to one of the other windows. Now I can work in this pane and use it as a completely separate working area. This way, I can organize my thoughts and have multiple things running all at once.

    01:39 In order to remove a pane, I can either type exit, which closes it, or I can also type Ctrl-d. If I type Ctrl-d from the last pane, then tmux will exit. That's all that you need to know in order to use tmux in its basic form.

    01:55 It's tmux to start it, and then Ctrl-b" or Ctrl-b% in order to create your panes. Then to close them, you just need to close all the panes. If you ever have questions about tmux usage, remember you can always do Ctrl-b and the question mark key to bring up a list of all of the different key shortcuts.

    Discuss

    Discuss