Getting Started with tmux: A short guide

Pratyukt WritesPratyukt Writes
2 min read

Hey folks! 🌟 Today, I’m going to give you the lowdown on tmux, which has become my new favorite tool. If you’re into managing multiple terminal sessions without losing your mind, tmux is about to be your new best friend. So, let’s dive in and see how this tool can make your life easier!

What’s TMux?

Think of tmux as a magic wand for your terminal. It’s a terminal multiplexer, which basically means it lets you split your terminal into multiple panes and windows. This way, you can do a bunch of things at once without juggling between different terminal windows. Pretty cool, right?

Getting Started 🚀

  1. Install TMux 🛠️ First things first, you need to install tmux. If you’re on macOS, just run:

     codebrew install tmux
    

    For Linux, use

     apt-get install tmux
    

    Easy peasy!

  2. Start a TMux Session 🎬 Open your terminal and just type:

     tmux
    

    This will start a new tmux session. You’ll see a green bar at the bottom of your terminal—that’s tmux doing its thing.

  3. Split Your Terminal ✂️ Now the fun begins! To split your terminal into panels, use:

    • Vertical split: Ctrl+b then %

    • Horizontal split: Ctrl+b then "

You’ll see your terminal split into separate panes where you can run different commands. Awesome for multitasking!

  1. Navigate Between Panes 🔄 To move between panes, press Ctrl+b and then use the arrow keys. Super handy for when you’re juggling different tasks.

  2. Create and Switch Between Windows 📑 tmux also lets you create multiple windows within a session:

    • New window: Ctrl+b then c

    • Switch between windows: Ctrl+b then the window number (e.g., 0, 1)

  3. Detach and Reattach 🚪🔄 One of the best features is detaching and reattaching to sessions. If you need to step away but don’t want to close everything:

    • Detach: Ctrl+b then d

    • Reattach: Type tmux attach-session

This way, you can leave your stuff running and come back exactly where you left off.

  1. End a Session 🚀 When you’re done, you can kill your tmux session by typing exit in each pane or by pressing Ctrl+b then &.

Wrapping Up

That’s the basics of tmux! It might seem like a lot at first, but once you get the hang of it, it’s a total game changer. You’ll be running multiple commands, managing projects, and multitasking like a pro.

Give it a try and see how much smoother your terminal life can be. Happy tmuxing! 😄👍

0
Subscribe to my newsletter

Read articles from Pratyukt Writes directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pratyukt Writes
Pratyukt Writes