#Waiting & closing

Let a session run to the finish, close it cleanly when you are done, and keep the receipt either way.

#Overview

A Shell session has a life of its own. You can start work, let it run, and decide when you are finished with the session itself — separately from whether any single command is still running. Two simple actions cover the end of a session's life: waiting for it to finish, and closing it when you are done.

The important thing to hold onto is that closing a session is clean and safe. The durable receipt of everything the session did stays available after you close it, so closing is a tidy way to end your work — not a way to lose it. This page also clears up a common point of confusion: stopping a command is not the same as closing a session.

#What you can do

  • Wait for a session to finish. When a session is working toward a result, you can wait for it to complete and be told when it is done, rather than watching every line.
  • Close a session cleanly. When you are finished with a session, you can close it. Closing is a clean stop that ends the session and tidies it away.
  • Keep the receipt. After you close a session, its durable receipt remains — you can return to it and see exactly what happened, even though the session itself is closed.
  • Stop a running command without ending the session. If one command is misbehaving, you can stop just that command and keep the session open to continue.

#How to use it

#Waiting for a session to finish

  1. Start the work in a session and let it run. For longer jobs, the work continues in the background while you do other things.
  2. When you want the result, wait for the session to finish. You do not have to watch it the whole time — you are told when it is done.
  3. If you stepped away, come back to the session and review the result. Nothing is lost while you wait, and the live output is there to scroll through.
Tip

If you would rather be pulled back than poll, let the job run in the background and rely on being notified the moment it finishes. See Running in the background.

#Closing a session

  1. When you are finished with a session, end it cleanly with the built-in close command — or close it from the interface.
  2. Closing is a clean stop: the session ends and is tidied away. It is the right way to finish when you no longer need that session active.
  3. The session's durable receipt remains afterward, so you can come back later and see exactly what the session did.

You can type close inside the session:

text
close

#Stopping a command vs. closing a session

These are two different actions, and knowing the difference keeps you in control:

ActionWhat it doesWhat stays
killStops the command that is currently runningThe session stays open and ready for more
closeEnds the whole session cleanlyThe durable receipt of the session remains
  • Use kill when one command is stuck or wrong but you want to keep working in the same session.
  • Use close when you are done with the session entirely.
Important

Closing a session does not erase your work. The durable receipt of what the session did is kept, so you can return to it and review exactly what happened after the session is closed.

#Examples

text
Wait for the build session to finish, then tell me how it went.

You see the session run to completion on its own. When it is done, you are notified and shown the final result, with the live output available to scroll back through.

text
That command is stuck — stop it but keep the session open.

You see the running command stop immediately while the session stays active and ready for your next command. Nothing else in the session is disturbed.

text
I'm done here — close this session.

You see the session end cleanly and tidy itself away. Its durable receipt remains, so the full history of what the session did is still there to revisit later.

#Tips

  • Stopping always works immediately at any permission level — if a command is running away from you, stop it the moment you notice, then decide whether to keep the session or close it.
  • Reach for kill to stop one command and close to end the whole session. Mixing them up is the most common cause of "I closed it by accident" or "it's still running."
  • Closing is safe by design — because the durable receipt survives, you can close a finished session without worrying about losing the record of what it did.
  • If you are not sure a session has truly finished, wait for it explicitly rather than assuming; you will be told when it is genuinely done.