• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

detach

Linux Screen

December 26, 2022

Just documenting the Linux Screen command.

Install screen first.

yum install screen
dnf install screen
apt install screen
zypper install screen

yum install screen dnf install screen apt install screen zypper install screen

Start a new screen.

screen -S one
screen -S two
screen -S three

screen -S one screen -S two screen -S three

Detach from screen.

Ctrl+a+d

Ctrl+a+d

List active screens.

screen -ls 
There is a screen on:
        15575.one   (Detached)
        15581.two   (Detached)
        15593.three (Detached)
1 Socket in /var/run/screen/S-root.

screen -ls There is a screen on: 15575.one (Detached) 15581.two (Detached) 15593.three (Detached) 1 Socket in /var/run/screen/S-root.

Reattach to an existing screen.

screen -r one
screen -r two
screen -r three

screen -r one screen -r two screen -r three

If there’s only one active screen, you can run screen -r without the name.

screen -r

screen -r

To exit or quit a screen, reattach and run exit.

screen -r three
# exit
[screen is terminating]

screen -r three # exit [screen is terminating]

Filed Under: Linux Tagged With: attach, detach, list, screen

Linux Screen

May 7, 2020

If you don’t have it installed.

yum install screen
apt install screen

yum install screen apt install screen

Before you run a process, run screen, and detach.

screen
# run the command
ping yahoo.com
# ctrl-a and ctrl-d to detach

screen # run the command ping yahoo.com # ctrl-a and ctrl-d to detach

To reattach, get a list of screen sessions, and attach to it.

screen -ls
# result is somewhat similar to below
4452.hostname
# attach to it
screen -dr 4452.hostname

screen -ls # result is somewhat similar to below 4452.hostname # attach to it screen -dr 4452.hostname

To stop, just type exit from the screen terminal.

Filed Under: Linux Tagged With: attach, detach, screen

GCP Attach Detach Disks

December 23, 2018

Google Cloud Platform just recently released a beta feature called detaching and attaching boot disks. Previously, boot disks were permanently attached to their VM instances. Now you have the ability to detach boot disk from your instance and attach it to another instance without deleting the original instance. You can also replace the boot disks for an instance rather than recreating the entire instance. I’ve tested it on my test account, and it works quite nicely.

I have 2 servers called blue-server and red-server. I’m detaching the disks on blue-server and attaching it to the red-server.

gcloud compute instances detach-disk blue-server --disk=blue-server-disk --zone us-central1-c
gcloud compute instances attach-disk cyan-server --disk=blue-server-disk --zone us-central1-c
gcloud compute instances detach-disk cyan-server --disk=blue-server-disk --zone us-central1-c
gcloud compute instances attach-disk blue-server --disk=blue-server-disk --zone us-central1-c

gcloud compute instances detach-disk blue-server --disk=blue-server-disk --zone us-central1-c gcloud compute instances attach-disk cyan-server --disk=blue-server-disk --zone us-central1-c gcloud compute instances detach-disk cyan-server --disk=blue-server-disk --zone us-central1-c gcloud compute instances attach-disk blue-server --disk=blue-server-disk --zone us-central1-c

Results:

GCP: Attach and Detach Disks

This new GCP feature is still beta. There might be a few quirks here and there, but overall, it’s a must have feature if you are managing OS.

Filed Under: Cloud Tagged With: attach, boot, detach, disks, gcp

  • Home
  • About
  • Archives

Copyright © 2023