Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with tmux

You're reading from   Getting Started with tmux Maximize your productivity by accessing several terminal sessions from a single window using tmux

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher Packt
ISBN-13 9781783985166
Length 148 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Victor Quinn Victor Quinn
Author Profile Icon Victor Quinn
Victor Quinn
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Jump Right In 2. Configuring tmux FREE CHAPTER 3. Sessions, Windows, and Panes 4. Manipulating Text 5. Diving Deeper 6. tmux for SSH, Pair Programming, and More 7. Using Other Tools with tmux A. Appendix Index

Explaining tmux commands

Now you may notice that attach-session sounds like a pretty long command. It's the same as list-sessions, and there are many others in the lexicon of tmux commands that seem rather verbose.

Tab completion

There is less complexity to the long commands than it may seem because most of them can be tab-completed. Try going to your command prompt and typing the following:

$ tmux list-se

Next, hit the Tab key. You should see it fill out to this:

$ tmux list-sessions

So thankfully, due to tab completion, there is little need to remember these long commands.

Note that tab completion will only work in certain shells with certain configurations, so if the tab completion trick doesn't work, you may want to search the Web and find a way to enable tab completion for tmux.

Aliases

Most of the commands have an alias, which is a shorter form of each command that can be used. For example, the alias of list-sessions is ls. The alias of new-session is new.

You can see them all readily by running the tmux command list-commands (alias lscm), as used in the following code snippet:

$ tmux list-commands

This will show you a list of all the tmux commands along with their aliases in parenthesis after the full name.

Throughout this text, we will always use the full form for clarity, but you could just as easily use the alias (or just tab complete of course).

One thing you'll most likely notice is that only the last few lines are visible in your terminal. If you go for your mouse and try to scroll up, that won't work either! How can you view the text that is placed above? We will need to move into something called the Copy mode that has its own chapter later in this text (See Chapter 4, Manipulating Text).

Renaming windows

Let's say you want to give a more descriptive name to a window. If you had three different windows, each with the nano editor open, seeing nano for each window wouldn't be all that helpful.

Thankfully, it's very easy to rename a window. Just switch to the window you'd like to rename. Then <Prefix>, , will prompt you for a new name. Let's rename the nano window to masterpiece .

See how the status line has been updated and now shows window 0 with the masterpiece title as shown in the following screenshot. Thankfully, tmux is not smart enough to check the contents of your window; otherwise, we're not sure whether the masterpiece title would make it through.

Renaming windows

Killing windows

As the last stop on our virtual tour, let's kill a window we no longer need. Switch to window 1 with our find-window trick by entering <Prefix>, f, cat test, Enter or of course we could use the less exciting <Prefix>, l command to move to the last opened window.

Now let's say goodbye to this window. Press <Prefix>, & to kill it. You will receive a prompt to which you have to confirm that you want to kill it.

This is a destructive process, unlike detaching, so be sure anything you care about has been saved.

Once you confirm it, window 1 will be gone. Poor window 1! You will see that now there are only window 0 and window 2 left:

Killing windows

You will also see that now <Prefix>, f, cat test, Enter no longer loads window 1 but rather says No windows matching: cat test. So, window 1 is really no longer with us.

Whenever we create a new window, it will take the lowest available index, which in this case will be 1. So window 1 can rise again, but this time as a new and different window with little memory of its past. We can also renumber windows as we'll see later, so if window 1 being missing is offensive to your sense of aesthetics, fear not, it can be remedied!

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime