• ARTICLES
SEARCH

How-To Geek

2 Alternatives to GNU Screen for Linux Terminal Multitasking

image

We’ve written about using GNU Screen to multitask in the Linux terminal in the past. GNU Screen is the granddaddy of these programs, but tmux and dvtm+dtach are other solutions you may prefer.

Tmux is an improved rewrite of GNU Screen. Dvtm is a console multiplexer inspired by tiling window managers, and dtach adds the ability to detach from and reattach to dvtm sessions.

Tmux

As a rewrite of GNU Screen, tmux offers a variety of improvements. Some of the most important include a client-server model, which allows you to connect to a tmux session from multiple locations, and a cleaner configuration file format. Check out tmux’s FAQ to discover a list of ways it differs from GNU Screen.

Use this command to install tmux on Ubuntu:

sudo apt-get install tmux

If you’re using another distribution, you’ll likely find it in your distribution’s package manager.

To launch tmux after installing it, just run the tmux command. Unlike Screen, tmux comes with a status bar by default.

image

To open an additional terminal window, use the Mod-c keyboard shortcut. The default modifer key combination is Ctrl-b. This means that you’ll have to press Ctrl-b and then c to create a new window.

Each new window you open will appear in the status bar. By default, tmux only shows one window on the screen at a time.

image

Here are some important keyboard shortcuts to get you started:

Mod-X – Kill the current terminal.

Mod-n – Focus next window.

Mod-p – Focus previous window.

Mod-# – Focus the specified window, where # is a number between 0 and 9.

Mod-’ – Prompt for a window to select.

Mod-% – Split the current window into two horizontally.

Mod-” – Split the current window into two vertically

image
To detach from the current session, use the Mod-d keyboard shortcut.

To reattach to a session, run the following command:

tmux attach

image

For more keyboard shortcuts, run the man tmux command or read tmux’s manual on the web.

Dvtm & Dtach

Unlike GNU Screen and tmux, dvtm doesn’t allow you to disconnect and reattach to sessions. You’ll have to run dvtm with dtach to detach from and reattach to your sessions.

Run this command to install dvtm and dtach on Ubuntu:

sudo apt-get install dvtm dtach

These programs should be available in other distribution’s software repositories, too.

Run the dvtm command to launch dvtm. You’ll see a single terminal window.

image

To open additional terminal windows, use the Mod-c keyboard shortcut. The default modifier key combination is Ctrl-g. This means that you’ll need to press Ctrl-g and then c to open a new terminal window.

Like a tiling window manager, dvtm will lay out the terminal windows automatically. Unlike the other utilities, it displays them all on the screen by default.

image

Here are some important keyboard shortcuts to get you started:

Mod-x – Close the current window.

Mod-j – Focus next window.

Mod-k – Focus previous window.

Mod-# – Focus the specified window, where # is the number of the window.

Mod-q - Quit dvtm.

For a full list, run the man dvtm command or check out dvtm’s manual page on the web.

Dvtm also supports the mouse. For example, you can click one of the windows to select it.

image

To detach from a dvtm session and reattach to it later, you’ll have to run it with the dtach command. To launch dvtm with dtach, use the following command:

dtach -c /tmp/dvtm-session -r winch dvtm

image

To detach from a dvtm session that’s been started with dtach, use the Ctrl-\ keyboard shortcut.

To reattach to your dvtm session later, use the following command:

dtach -a /tmp/dvtm-session -r winch

image

You can use dtach to run, detach from, and reattach to other applications, too.


You may also want to check out byobu, which enhances GNU Screen.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 05/22/12

Comments (10)

  1. Casand

    Really a good one , thanks for sharing it.

  2. robin

    Terminator is a great addition to this list imho:

    http://www.tenshu.net/p/terminator.html

  3. Justin

    I use guake. It’s a great use and transparent. You can hide it and refocus it with f12.

  4. Jack

    I was looking for something just like this the other day, and was wondering if screen could be manipulated to do this.

    This is a much better solution, thanks a million!

  5. Ezitoc

    Nice and usefull! Thanks for sharing!

  6. Citrus Rain

    I am going to download this and make it have the color scheme that Aperture Science has on theirs.

  7. Tell us

    Please support email install an active cellphon in set up automatiky.tank you

  8. Simon Pitt

    Search for Gnome Connection Manager in Google. I run an IT business with many CentOS servers. GCM is simple, very functional and free.

    Hope it helps!

  9. Mark Esbrok

    I don’t understand the the “Mod” part of the shortcuts. Can you explain in more detail for me how I do the “Mod” part. I’ve just started using Linux and love it. I really want to experiment with the split screens but just a little confused right now.
    Thank You.

  10. Mark Esbrok

    Never mind. I understand the ctrl-g and ctrl-b default commands for Mod.
    This is great.
    Thanks

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!