---
title: "tmux attach"
description: "https://youtu.be/JQ0yDCVu44E"
date: 2021-07-31
published: true
tags:
  - cli
  - linux
  - tmux
template: blog-post
---


https://youtu.be/JQ0yDCVu44E

attach is one of the most useful features of tmux.  If you have no interest in
tmux for pane and window management, you should use tmux for this.  It can be a
life saver if you ever get disconnected from the host machine or accidently
close your terminal you can connect right back into the session you were just
in using attach.

## attach

``` bash
tmux attach
```

> this command will simply attach back to tmux if you are ever disconnected

If you ever run long running tasks on a remote machine by sshing into this you
should be doing it inside tmux, or something like tmux so that you do not loose
your work.

## attach to a specific session

If you have multiple sessions running you can select the session that you want
to attach to by passing `-t <name-of-session>`.

``` bash
tmux attach -t scratch
```

<a href="/tmux-nav-2021/" class="wikilink" data-title="How I navigate tmux in 2021" data-description="change_speed = (speed) =&gt; [...document.querySelectorAll(&#39;video&#39;)].map(v =&gt; v.playbackRate=v.playbackRate+speed)" data-date="2021-05-11">How I navigate tmux in 2021</a>

> for more information on how I navigate tmux, check out this full post

Also check out the full YouTube
[tmux-playlist](https://www.youtube.com/playlist?list=PLTRNG6WIHETB4reAxbWza3CZeP9KL6Bkr)
to see all of the videos in this series.
