5 ways to split your Linux terminal

What's your favorite terminal multiplexer? Take our poll. Then read about how Linux offers plenty of ways for you to split your terminal so you can multitask.
156 readers like this.
FreeDOS

Opensource.com

Is there anything better than a warmly flickering Linux terminal?

Sure there is: two warmly flickering Linux terminals. In fact, the more, the better.

Long ago, terminals were physical devices, but of course, today, they're just emulated as an application on your computer. If you prefer the terminal as your interface, you probably know that one terminal is rarely enough. Inevitably, you're going to open a new terminal or a new tab so you can work in it while your first is busy compiling or converting or otherwise processing data.

If you're a sysadmin, then you know you're going to need at least four open windows while you work on several systems at the same time.

Terminal applications with tabs have existed on Linux for a long time, and luckily, that trend seems to have caught on such that it's an expected feature of a modern terminal. And yet, sometimes it's distracting or inconvenient to flip back and forth between tabs.

The only answer is a split screen so that two or more terminals can exist at the same time within just one application window. There are many tools in your Linux kit to help you slice and dice your consoles.

Shells, terminals, and consoles

Before you slice and dice screens, you should know the difference between a terminal, a shell, and a "console." To get the full picture, read my article on the subject over on the Enable Sysadmin blog.

The short version:

  • A shell is an input and output screen with a prompt. There's technically a shell running somewhere underneath your POSIX desktop, even when it's not visible (because it's a shell that launched your user session).
  • A terminal is an application running within a graphics server (such as X11 or Wayland) with a shell loaded into it. A terminal is only running when you have a terminal window launched. It's more or less a "portal" into your shell.
  • "Console" or "virtual console" is a term usually used to imply a shell running outside of your desktop. You can get to a virtual console by pressing Alt-Ctrl-F2 (more are usually available from F3 up to F7, with F1 or F7 representing your desktop, depending on your distribution).

Some applications let you split your shell or console, while others let you split your terminal.

tmux

tmux terminal

Arguably the most flexible and capable of screen splitters, tmux is a keyboard-centric terminal multiplexer, meaning that you can "layer" one console on top of another and then switch between the two. You can also split a console view in half (or thirds or fourths, and so on) so you can see other consoles next to it.

All controls center around the keyboard, which means you never have to take your hand off the keys in search of a mouse, but also that you must learn some new keyboard combos.

If you're using tmux primarily for screen splitting, then the only commands you really need are these:

  • Ctrl-B % for a vertical split (one shell on the left, one shell on the right)
  • Ctrl-B" for a horizontal split (one shell at the top, one shell at the bottom)
  • Ctrl-B O to make the other shell active
  • Ctrl-B ? for help
  • Ctrl-B d detach from Tmux, leaving it running in the background (use tmux attach to reenter)

There are many benefits to tmux, including the ability to start a tmux session on one computer, and then join that same session from another computer remotely. It essentially daemonizes your shell.

It's with tmux running on a Pi, for example, that I can stay logged into IRC on a permanent basis—I start tmux on the Pi, and then log in from whatever computer I happen to be on. When I log out, tmux continues to run, patiently waiting for me to reattach to the session from a different computer.

GNU Screen

GNU Screen terminal

Similar to tmux, GNU Screen is a shell multiplexer. You can detach and reattach from a running session, and you can split the screen both horizontally and vertically.

Screen is a little clunkier than tmux. Its default key binding is Ctrl-A, which also happens to be Bash's keyboard shortcut to go to the beginning of a line. This means that if you have Screen running, you must press Ctrl-A twice instead of just once to go to the beginning of the line. Personally, I redefine the trigger key to Ctrl-J with this line in $HOME/.screenrc:

escape ^jJ

Screen's split function works well, but it leaves out a few pleasantries that tmux lacks. For instance, when you split your shell, a new shell does not start in the other panel. You have to navigate to the other space with Ctrl-A Tab (or Ctrl-J if you redefine your keyboard shortcut as I do) and create a new shell manually with Ctrl-A C.

Unlike tmux, a split doesn't go away when you exit a shell, which is a design feature that's quite nice in some instances but can also sometimes be cumbersome because it forces you to manage your splits manually.

Still, Screen is a reliable and flexible application that you can run should you find that tmux is unavailable to you.

Here are the basic split commands, using the default keyboard shortcuts:

  • Ctrl-A | for a vertical split (one shell on the left, one shell on the right)
  • Ctrl-A S for a horizontal split (one shell at the top, one shell at the bottom)
  • Ctrl-A Tab to make the other shell active
  • Ctrl-A ? for help
  • Ctrl-A d detach from Screen, leaving it running in the background (use screen -r to reenter)

Konsole

Konsole screen

Konsole is the terminal bundled along with the KDE Plasma desktop. Like KDE itself, Konsole is famous for being highly customizable and powerful.

Among its many features is the ability to split its window, similar to both tmux and GNU Screen. Because Konsole is a graphical terminal, you can control its split-screen feature with your mouse instead of your keyboard.

Splitting is found in the View menu of Konsole. You can split your window horizontally or vertically. To change which panel is active, just click on it. Each panel is a unique terminal, so it can have its own theme and tabs.

Unlike tmux and GNU Screen, you can't detach and reattach from Konsole. Like most graphical applications, you use Konsole while you're physically in front of it, and you lose access to it when you're away (unless you use remote desktop software).

Emacs

Emacs rpg

Emacs isn't exactly a terminal multiplexer, but its interface supports splitting and resizing, and it has a built-in terminal.

If you're in Emacs on a daily basis anyway, the ability to split your window between essentially different applications means you never have to leave the familiarity and comfort of your favorite text editor. Furthermore, because the Emacs eshell module is implemented in eLISP, you can interact with it using the same commands you use in Emacs itself, making it trivial to copy and yank long file paths or command output.

If you're using Emacs in a graphical window, you can perform some actions with your mouse. It's faster to use keyboard shortcuts, and some are more or less required. For instance, you can change which panel is the active one by clicking into it, and you can resize the proportions of your split screen with your mouse.

These are the important keyboard shortcuts:

  • Ctrl-X 3 for a vertical split (one shell on the left, one shell on the right)
  • Ctrl-X 2 for a horizontal split (one shell at the top, one shell at the bottom)
  • Ctrl-X O to make the other shell active (you can also do this with the mouse)
  • Ctrl-X 0 (that’s a zero) close the current panel

Similar to tmux and GNU Screen, you can detach and reattach from Emacs as long as you run emacs-client.

Window manager

Ratpoison split screen

Should you think a text editor that can split its screen and load a terminal is amazing, imagine your desktop serving the same purpose. There are Linux desktops, like Ratpoison, Herbsluftwm, i3, Awesome, and even the KDE Plasma desktop with specific settings enabled, that present each application window to you as a fixed tile in a desktop grid.

Instead of windows floating "above" your desktop, they remain in a predictable place so you can change from one to the other. You can open any number of terminals within your grid, emulating a terminal multiplexer. In fact, you could even load a terminal multiplexer in your desktop multiplexer.

And there's nothing stopping you from loading Emacs with split buffers inside of that. No one knows what happens if you take it further than that, and most Linux users agree it's best not to find out.

Unlike tmux and GNU Screen, you can't detach and reattach from your desktop unless you count using remote desktop software.

Other options

Believe it or not, these aren't the only options you have to split your screen on Linux. There are other terminal emulators, like Tilix and Terminator before it, that can split into sections, and applications with embedded terminal components, and much more. Tell us your favorite way of splitting up your workspace in the comments.

What to read next
Tags
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

28 Comments

I never got the fascination with splitting terminals full screen. I simply open as many as I need and let them cascade. If, by chance, I need them side by side, I can always drag them. There's never a real need to have all the terminals in a single window, as we are, sadly, only able to focus on a single element with our eyes. So while technology allows us to fill the screen with information, biology dictates that you don't really see it.
Also, screen and Tmux are much more than just for splitting a terminal, they are a relic of a time where all you had was one window and one terminal and the only way to access multiple processes was with a multiplexer. These days, well, we don't need this. There are valid uses for screen/tmux of course, but less on the display side, unless you are running without X in a frame buffer environment.

Great points, Erez.

I think splitting screens appeals to some users because it makes it easy to cross-reference information in other panes without everything being in separate windows. It's a subtle difference, but I know that in Emacs I appreciate the ease and fluidity with which I can move from one buffer to another without depending on a window manager.

As for the other uses of screen and Tmux, they've been "ignored" in this article because I'm focusing on splitting terminals specifically. I use Tmux to do much much more than just split a screen. Maybe I'll write an article about it some day!

In reply to by Erez Schatz

Funny you should mention emacs, I use emacs as well in a single frame-per-buffer setting. While this used to be a mess in older times, modern GUIs like Gnome and MacOSX allow for better navigation with Alt/command-Tab between only the programs and Alt/Command-` between the windows of the same program. And as usual, the Window manager is the best tool around for managing windows.

In reply to by sethkenlon

It's my understanding that attention is more nuanced. We learn without direct attention (or reinforcement for that matter -- see Bobo doll experiment) and internalize context without attention (think reacting to a motion if our peripheral vision).

It's fair to say context is helpful, and anyone who's watched a file in one window while running commands in another can have an appreciation for split screens.

In reply to by Erez Schatz

Indeed I tend to use tmux as an IDE together with vim. I have half of the screen occupied by the source code I am editing, and the other half (or less) with the terminal on which I test the program.

Working very often through ssh on remote servers without a graphical interface, this solution is perfect for me.

In reply to by mbbroberg

Your eyes move much faster than your fingers. And alt-tabbing through windows isn't scalable, unless you have a window manager that allows you to have specific hotkeys to switch to a specific window instead of having to think "which instance of VSCode was my API code in" when switching between two instances of vscode or something.

You're also not accounting for "watching" things. You may have a program outputting content in a terminal instance. You can "see" the "motion" in the corner of your eye, and have your attention drawn to the issue. If it's behind another window that can't happen. A window manager can of course help with this, in my desktop I can use windows+left/right/etc. But this doesn't work if you're shelled into a server or something, and sometimes it's nice to have it in your resizable terminal window.

In my work as a programmer this all is most certainly not an edge case.

In reply to by Erez Schatz

Very informative article!
Keep writing

Emacs id the Best

I've never caught on to this splitting up of terminals/screens. With screens I create more desktops so apps can be full screen. In the terminal I create tabs.

My favourite program for managing split console screen is byobu. Under the hood it uses tmux but it just seems so much easier to use.

It has full mouse support too which means resizing and navigating between splits is easy to do when you can't remember that weird keyboard shortcut!

Splitting of terminals has been a way of (operational) life for me since diving into virtualization ~5 years ago. I either use Remmina, a RDC or Tilix, a terminal emulator. I normally have 4 terminals up for any combination of local admin or admin'ing VMs, nested VMs and LXC containers.

I use Remmina for established resources; addresses which are largely fixed. Tilix is wonderfully nimble for the more fluid test & dev environments and has extensive configurability to give ample visual cues as to where one is.

As far as the splitting of terminals, the principal value to me is this gives me a fairly good (albeit ad hoc) "single pane" view of what I'm working on.

Thanks for y.a. good article Seth.

It's bizarre that not one mention is made in the article or comments of why tmux/screen, their wrapper byobu or the asynchronous and latency tolerant mosh (not even mentioned) are popular, e.g. remote sessions that can survive disconnection and can even support sharing.

Even if you want to concentrate on the windowing functionality alone, the obvious use case is like any tiling window manager (including Emacs), to allow working with multiple applications at once like a graphical desktop, including features like maximizing windows and remote access.

tldr; The primary use case is development work by remote, with window management.

I see your point. We have other articles talking about Tmux and all of its remote benefits, so I was hoping to focus on options rather than workflow. But I think you're right: more documentation about how these tools are used (whether to "daemonize" your login or to mirror your input or just for window management) is justified. Watch this space (where "this" = opensource.com)

In reply to by S (not verified)

No mention of being able to broadcast commands to all screens or groups of screens?

I focused on options rather than workflow for this article. This is a great feature, though. I often use it during tech demos, so I can have notes open in one window, and broadcast a synchronized Tmux session to viewers.

In reply to by Ben88888 (not verified)

I use Terminator locally and byobu on the remote servers.
Byobu is very convenient as also Matt Kurter said above. And very easy to learn because it uses the function keys to manage the split screens. So if you do not remember the correct key to press, you can just try. It is also fully customizable.

I need to use locally terminator because if I use byobu locally and I ssh to a server then it is not easy to manage two multiplexer one inside another.
If one has a clever solution for it, please let me know.

I think that split terminals tools like Tmux are more useful working with a real terminals (TTY).
There's no needed working with terminals emulators (like Konsole, my option) that maybe can do that with their own options.

Always interesting!! :)

Happy hacking!

I used both screen and byobu. I have never splitted screen thought, I just create a new one with Ctrl-A + C and then switch between both with Ctrl-A N and P. Paired with ssh it's much better to leave a terminal prepared at home, then connect from work to that screen already running and detach when I quit.

One thing not mentioned above is that it's possible to synchronize the keystrokes in some multi-terminal multiplexers (I use tmux mostly, and byobu occasionally).

I open 4 terminals (each in a quadrant) and ssh into 4 separate servers. Then I type what I want once (e.g., updating all of the packages on each system) and all 4 sessions get updated at the same time, and I can see the output on all simultaneously.

If one of the sessions has an issue, I can easily unsynchronize the keystrokes, fix that session, and synchronize again (if necessary).

It's more efficient than repeating the commands 4 times.

guake is an option

There is also good old and simple splitvt command.

At work I use a remote sever for development which I connect to over SSH.
After connecting I tend to launch Neovim in my project's root directory and pretty much never exit out of it. That's because of nvim's built-in terminal emulator feature. I simply type ':split | term' and that way I have windows with both - files and a terminal in the same nvim instance. Such a solution makes copying an output of terminal commands really easy as you simply use nvim's registers. Also opening files from terminal windows (e.g. found by grep -r, ack, ag or find) with 'gF' is extremely convenient.
Of course I can have multiple terminal instances open and arrange them in the tabs and windows as I want. Additionally, saving and loading sessions (tabs and windows layout as well as file and terminal buffers are preserved) make for a prefect workflow for me as a developer.

I swear everyday I use splitting terminals (especially Terminator).
I'm too lazy to resize my window so I just split the full screen terminal window.
Plus added feature is a way to simultaneously type a command on one terminal and sent across all open terminals. This is by far a killer feature for terminator.
Grouping your terminal sessions and sending commands to all open terminal, simple and quick!

All these are good features, but one thing I can't live without is the split screen with Terminator. Plus you can group those split terminals and you can send a command to all terminals at once.
Plus the GUI for terminator is very intuitive and easy to split. These are by far the reasons why I stick to it on my everyday work.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.