Right now we’re trapped in the newly created pane. To split a pane into top and bottom panes use the C-b " shortcut. Where there’s a split into left and right, there’s also a split into top and bottom pane. Voilà! You’ve just invoked your first tmux command and split your pane in two. This means: to split your single pane into a left and a right pane you press Ctrl and b at the same time, release both, and then type the % key. The shortcut to split panes into a left and a right pane is C-b %. Thus C-b simply means press the Ctrl and b keys at the same time. In “emacs” notation C- means “press and hold the Ctrl key” 3. This notation might read a little weird if you’re not used to it. We want a nice split-screen, so let’s split this bad boy.Īll commands in tmux are triggered by a prefix key followed by a command key (all you emacs weirdos out there will feel right at home). When you create a new session, tmux will by default start with one window and a single panel inside. Now that we’ve created our first session we can get a feeling for panes. The status bar can also be customized and I’ve seen some really fancy stuff around (upcoming calendar events, battery status, to name a few) but this is something we’ll leave for later. Apart from the currently opened windows (on the left) it also shows some system information like date and time (on the right). The status bar is an important part of tmux. This will create a new tmux session with a nice all-green status bar at the bottom: Starting Your First Sessionįor your first session simply start tmux with a fresh session: Installationįortunately installing tmux is pretty straightforward on most operating systems: a simple sudo apt-get install tmux (Ubuntu, WSL and derivatives) or brew install tmux (Mac) should be sufficient. Simply open your terminal and follow the instructions. It will only cover the basic features which should be more than enough to get started and be productive with tmux. This hands-on guide will get you up and running with tmux pretty quickly. Let’s get our hands dirty! Getting Started Think of tmux as an easier-to-use and a little more powerful alternative to Screen (obviously I’m being opinionated here).Įnough with the concepts. If you are familiar with GNU Screen this might all sound familiar. You see that tmux basically offers two big features: I’ll just start a new session for my new task and attach to the old session whenever I want to continue with my old task. Personally I find myself detaching from sessions when I’m switching context. Not only for its window management features but also for the session handling. Tmux is helpful when working on a remote machine but it shines just as much when you’re working locally. To continue your session simply ssh to the server again and attach to the running session. If you’ve ever worked with remote servers or a Raspberry Pi over ssh you can guess where this will be useful: When you lose your ssh connection the tmux session will simply be detached but will keep running on the server in the background including all the processes that run within your session. This is incredibly useful because at any later point in time you can pick that session up exactly from where you left it by simply “attaching” to that session. tmux will keep this session alive until you kill the tmux server (e.g. On top of that tmux keeps these windows and panes in a session. This allows you to have multiple terminal commands and applications running side by side without the need to open multiple terminal emulator windows. Each pane will contain its own, independently running shell instance (bash, zsh, whatever you’re using). Behind this fancy term hides a simple concept: Within one terminal window you can open multiple windows and split-views (called “panes” in tmux lingo). Tmux’s authors describe it as a terminal multiplexer. If you’ve got 10 minutes to spare and want to earn street cred with your nerd friends: read on and become proficient with tmux! What’s tmux? This post will give you the same quick introduction to tmux and its possibilities, followed by the a 10 minute hands-on guide to set up and get to know tmux yourself. Simply speaking, tmux acts as a window manager within your terminal 1 and allows you to create multiple windows and panes within a single terminal window. It’s tmux, a so-called terminal multiplexer. This screenshot shows nothing less than the best thing since sliced bread. One of the most important tools to drive my daily command line experience is tmux. Over the years I’ve tried to streamline and customize my command line experience to be more convenient, more fun to use or just to look rad. The additional hacker/wizard/neckbeard kind of feeling you get when using a terminal comes for free, what’s not to love? I think there’s hardly any more productive and versatile tool for a software developer than the terminal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |