<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg" -->

---
title: netlab: Switch to Lab Directory After an SSH Session...
description: When an SSH session to a netlab server drops, finding which lab was running and its directory location is tedious. The solution uses netlab's `--format json`...
canonical: https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: netlab: Switch to Lab Directory After an SSH Session Loss « ipSpace.net blog | daily.dev
og:description: When an SSH session to a netlab server drops, finding which lab was running and its directory location is tedious. The solution uses netlab's `--format json`...
og:url: https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg
og:image: https://api.daily.dev/og/posts/Bsrcgi2pG.png
og:image:alt: netlab: Switch to Lab Directory After an SSH Session Loss « ipSpace.net blog
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# netlab: Switch to Lab Directory After an SSH Session Loss « ipSpace.net blog

**[ipSpace.net Blog](https://daily.dev/sources/ipspace)** · 3 min read · 0 upvotes · 0 comments

## Summary

When an SSH session to a netlab server drops, finding which lab was running and its directory location is tedious. The solution uses netlab's `--format json` option (added in release 26.02) combined with `jq` to extract the lab directory, then wraps the whole thing in a bash alias called `goback`. Running `goback` after reconnecting instantly switches to the correct lab directory.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.ipspace.net/2026/03/netlab-switch-lab-directory>

## Questions this post answers

### How do I automatically switch back to my netlab lab directory after reconnecting via SSH?

Use the `netlab status -i default --format json` command (available since release 26.02) piped through `jq .dir -r` to extract the lab directory path, then wrap it in a bash alias: `alias goback='cd $(netlab status -i default --format json | jq .dir -r)'`. Store the alias in `.bash_aliases` so it persists across sessions, and run `goback` after reconnecting.

_Network engineers juggling multiple lab sessions track netlab tips and tooling updates on daily.dev._

### When was the --format json option added to netlab status?

The `--format json` option for `netlab status` was added in netlab release 26.02. It allows structured extraction of lab metadata such as the lab directory, providers, and log lines, making it easy to pipe the output into tools like `jq`.

_Keeping up with netlab release notes is easier when relevant posts surface where developers already read on daily.dev._

## Similar posts on daily.dev

- [Compress netlab Lab Topologies with Dot Notation « ipSpace.net blog](https://daily.dev/posts/compress-netlab-lab-topologies-with-dot-notation-ipspace-net-blog-johomwxka) · ipSpace.net Blog · 0 upvotes · 0 comments
- [Yak-Shaving netlab Podman Support « ipSpace.net blog](https://daily.dev/posts/yak-shaving-netlab-podman-support-ipspace-net-blog-s4rwnwdcr) · ipSpace.net Blog · 0 upvotes · 0 comments

---

Tags: [#networking](https://daily.dev/tags/networking), [#bash](https://daily.dev/tags/bash)

[View this post on daily.dev](https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"netlab: Switch to Lab Directory After an SSH Session Loss « ipSpace.net blog","url":"https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg"},"datePublished":"2026-08-11T08:52:21.158Z","dateModified":"2026-08-11T09:04:36.967Z","description":"When an SSH session to a netlab server drops, finding which lab was running and its directory location is tedious. The solution uses netlab's `--format json`...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"ipSpace.net Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ipSpace.net Blog","logo":"https://media.daily.dev/image/upload/s--xS7E82MT--/f_auto,q_auto/v1786438303/logos/ipspace?_a=BAMAMicg0","url":"https://daily.dev/sources/ipspace"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"networking,bash","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ipSpace.net Blog","item":"https://daily.dev/sources/ipspace"},{"@type":"ListItem","position":3,"name":"netlab: Switch to Lab Directory After an SSH Session Loss « ipSpace.net blog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/netlab-switch-to-lab-directory-after-an-ssh-session-loss-ipspace-net-blog-bsrcgi2pg#faq","mainEntity":[{"@type":"Question","name":"How do I automatically switch back to my netlab lab directory after reconnecting via SSH?","acceptedAnswer":{"@type":"Answer","text":"Use the `netlab status -i default --format json` command (available since release 26.02) piped through `jq .dir -r` to extract the lab directory path, then wrap it in a bash alias: `alias goback='cd $(netlab status -i default --format json | jq .dir -r)'`. Store the alias in `.bash_aliases` so it persists across sessions, and run `goback` after reconnecting. Network engineers juggling multiple lab sessions track netlab tips and tooling updates on daily.dev."}},{"@type":"Question","name":"When was the --format json option added to netlab status?","acceptedAnswer":{"@type":"Answer","text":"The `--format json` option for `netlab status` was added in netlab release 26.02. It allows structured extraction of lab metadata such as the lab directory, providers, and log lines, making it easy to pipe the output into tools like `jq`. Keeping up with netlab release notes is easier when relevant posts surface where developers already read on daily.dev."}}]}
```

