![]() ![]() Or, say you initially started a screen with the command screen -S kernel-compile. If you become disconnected, and the screens haven’t detached, you can detach and reconnect with them manually with the command: This will happen if screen detects a network disconnection. The one issue we might have is that the only screens you can reconnect to are those listed as Disconnected. You can reconnect to one of those screens with the command like so: ![]() Issue the command screen -ls and you’ll see your two screens listed ( Figure B).Įach of those screens has a session ID, which allows you to reconnect. Hit the ++ (which switches to the next screen), and you’re back to the ping command.īut what happens when you lose your connection? Are your commands lost? No. You should now be back to your sudo tail -f /var/log/syslog screen. With that ping running, we can switch back to the previous screen with the key combination ++ (which switches to the previous screen). Now let’s ping our server with the command ping 192.168.1.208 (insert the IP address of your server). Now let’s open a new screen by hitting the ++ key combination. The tail command will start following input on the syslog log file (as expected). Let’s issue the command sudo tail -f /var/log/syslog. You will now find yourself at what looks like a standard prompt. Hit either the Spacebar or Enter to exit the welcome window. Where NAME_OF_COMMAND is the actual command you’d run. You can customize that screen to make it easier to remember what screen is running what command, like so: You will be greeted by a welcome window ( Figure A). Before you start working, issue the command screen. Secure Shell to your remote Linux server. If you’re using Fedora, that install command would be sudo dnf install screen. If you find it’s not there, you can install it with the command sudo apt install screen. On Ubuntu Server 16.04, the screen tool is already installed. Let’s walk through the process of using this handy command. You can open as many screens as you need, switch between them, detach them, list them, and reconnect to them. When you call the screen command, it creates a single window where you can work as normal. What is screen? Simply put, screen is a full-screen window manager that multiplexes a physical terminal between several processes. ![]() I’ll be demonstrating on Ubuntu Server 16.04, but screen is available for nearly all Linux distributions. I want to show you how to make use of this Linux admin tool. With screen, you can reconnect to that server and pick up where you left off with your last command. How many times have you secure shelled into your data center Linux servers, only to have (for whatever reason) your remote secure shell connection broken? When you reconnect to that server, is that critical command you issued still running? Or did the severed connection put the kibosh on the command? Not only can this be incredibly confusing, it can also be a cause for you to lose precious work and time.įortunately, there’s a way around this: The screen command. Jack Wallen shows you a handy Linux trick that can go a long way to prevent you from losing precious command line work due to questionable network connections to your remote servers. How to use the Linux screen command to keep your remote processes running ![]()
0 Comments
Leave a Reply. |