How to Use the Linux Screen Tool
HTML-код
- Опубликовано: 3 июн 2024
- Start learning cybersecurity with CBT Nuggets. courses.cbt.gg/security
In this video, Shawn Powers covers using the Linux Screen tool. You've got a command that'll take a long time and you want to keep it running in the background, and SSH in later from a different machine: manage your time - and your commands - with the Screen tool.
If you've ever started a command running that you knew was going to take a long time, you're probably already familiar with how hard it can be to keep background applications interactive - especially if after you set up the long process, you return to the device via SSH. If you close the window when you start the command, there's no way to get back to it - without the Screen tool, that is.
Watch and see how easy it is to start a Screen session - a sort of virtual backgrounded terminal window - and then how to disconnect and reattach screens that are running in the background. Since the screens stay saved, it's perfect for SSHing in later and seeing the results of long processes.
📁 Download the Ultimate Sysadmin Cert Guide: blog.cbt.gg/skqa
⬇️ 4-Week Study Plan: MD-100 & MD-101: blog.cbt.gg/1tso
Start learning with CBT Nuggets:
• Everything Linux | courses.cbt.gg/un3
• Linux Essentials | courses.cbt.gg/45b
• Linux Server Administration | courses.cbt.gg/ekv
• CompTIA Linux+ (XK0-004) | courses.cbt.gg/93y
• Linux Security | courses.cbt.gg/vu0
You can also run multiple screen sessions. To list out the sessions you can just do:
sudo screen -ls
If you want to reattach a session, just type:
session -r
and if you want to close one of your session you can do:
sudo kill
Lets run a command thats going to take a long time
Like ping google
I love these videos, straight to the point and entertaining
Short, sweet and straight to the point. 👌
Great. Short and sweet. To the point for busy ppl :D
Dude! This video is awesome! Exactly what I needed. Glad I clicked
Thank you, straight to the point
Thanks, I used screen some time back and forgot how it worked. This video brought back to me what I needed at the moment.
0:57 to screen session
1:18
1:19 ctrl + A to screen command mode
1:50
very helpful and compact... thanks!!
Thank you, nice and clear
Thank you
Thank you very much for this short and informative video! The "doctor" is a great idea because I used to keep forgetting this combination, so that's a really helpful way to remember it. One thing I still find confusing, though, is why you need to "detach" + reattach"? Why is that safer than simply saying "screen -r"?
Good question.
hey, this video has been helpful, but I've got a problem in the long run: my backend is started in a screen session on a VPS. Whenever VPS gets rebooted, the screen session get erased. Is there a way out to make this session persist or just make another one start right after the reboot?
Oh yes that's great. U mean to say it will take the control of that terminal outputs
I followed all the steps. It works on my Mac laptop but it did not work on the Linux server on which I am ssh-ed. Once I go back to the server, there is no screen to reattach.
Great vid
'screen -list' is also a way to list your sessions
Thats not all there is to screen. Ctrl+a then hit ? Key and you will see
how to take the output to a file ..you missed a very imp point
CBT Nuggets is so trash