Keep Your SSH Session Running when You Disconnect Keep Your SSH sesiju Running Atvienojot
Screen is like a window manager for your console. Ekrāns ir kā logu menedžeri jūsu konsoli. It will allow you to keep multiple terminal sessions running and easily switch between them. Tas ļaus Jums saglabāt vairākus gala sesijas norisē un viegli pārslēgties starp tiem. It also protects you from disconnection, because the screen session doesn't end when you get disconnected. Tas arī aizsargā jūs no atslēgšanu, jo ekrāns sesija nebeidzas, kad saņemsiet atvienots.
You'll need to make sure that screen is installed on the server you are connecting to. Jums ir jāpārliecinās, ka ekrāns ir instalēta servera esat savienojumu. If that server is Ubuntu or Debian, just use this command: Ja šim serverim ir Ubuntu vai Debian, vienkārši izmanto šo komandu:
sudo apt-get install screen sudo apt-get install screen
Now you can start a new screen session by just typing screen at the command line. Tagad jūs varat sākt jaunu ekrāna sēdē tikai ierakstot ekrāna komandrindu. You'll be shown some information about screen. Hit enter, and you'll be at a normal prompt. Jums ir jāparāda arī informāciju par to screen. Rezultāts iebraukt, un jums jābūt normālā ātri.
To disconnect (but leave the session running) Lai atvienotu (bet atstāt sesija darbojas)
Hit Ctrl + A and then Ctrl + D in immediate succession. Hit Ctrl + un tad Ctrl + D tiešā kārtas. You will see the message [detached] Jūs redzēsiet ziņojumu [atdalīts]
To reconnect to an already running session Atjaunot to, kas jau darbojas sesija
screen -r screen-r
To reconnect to an existing session, or create a new one if none exists Atjaunot savienojumu ar pašreizējo sesiju, vai izveidot jaunu, ja tāda nav
screen -D -r screen-A-r
To create a new window inside of a running screen session Lai izveidotu jaunu logu iekšpusē darbojas ekrāna sesija
Hit Ctrl + A and then C in immediate succession. Hit Ctrl + un tad C tiešā kārtas. You will see a new prompt. Tu redzēsi jaunu nekavējoties.
To switch from one screen window to another Lai pārslēgtos no viena ekrāna loga uz citu
Hit Ctrl + A and then Ctrl + A in immediate succession. Hit Ctrl + un tad Ctrl + tiešā kārtas.
To list open screen windows Lai sarakstu atvērtu ekrāna logi
Hit Ctrl + A and then W in immediate succession Hit Ctrl + un tad W tiešā kārtas
There's lots of other commands, but those are the ones I use the most. Pastāv daudz citu komandu, bet tie ir tie, es izmantoju visvairāk.

Daily Email Updates Daily Email Updates
You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:



What about keep sessions with server X redirected? Ko par to glabāt sesiju ar serveri X redirected? (ssh -X) (ssh-X)
It would be nice. Tas būtu jauki.
Thank you in advance Thank you in advance
The nohup command can help you there. Nohup komanda var palīdzēt jums tur. Have a quick google and you will find out all about it. Vai ātrā google un jūs atradīsiet visu par to.
I learned to use this command a long time ago the hard way when I was updating Redhat with more than 100 files including kernel updates over SSH and our the power in the office went dead. Es iemācījos lietot šo komandu jau sen cietā veidā, ja man bija atjaunināt Redhat ar vairāk nekā 100 faili, ieskaitot kodola atjauninājumus SSH un mūsu varas iestāde gāja miruši. Recovering from a half updated OS is not fun so I suggest you use “screen” when using “yum” or “apt-get”. Atgūstas no puse atjaunošana OS nav jautri, lai es jums iesakām izmantot "screen", izmantojot "Yum" vai "apt-get".