issue215:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue215:c_c [2025/03/29 14:50] – créée auntiee | issue215:c_c [2025/04/04 11:19] (Version actuelle) – jpl | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Last month, we looked a bit more in-depth at jobs, foreground and background processes. This allows me to segue into screen. Though we chatted about it before, (2022?), it was to segue into tmux. We can touch on tmux again - it is great - or tilix, but know that in the real world, you will probably connect to a jump host or a server that has only the OS installed, so things like tmux will not be available for you to use. Hence why I like to start off with screen, not that I’m old-skool or anything, I like tmux/tilix more, but trust me, you will get stuck with screen more often than not. | + | **Last month, we looked a bit more in-depth at jobs, foreground and background processes. This allows me to segue into screen. Though we chatted about it before, (2022?), it was to segue into tmux. We can touch on tmux again - it is great - or tilix, but know that in the real world, you will probably connect to a jump host or a server that has only the OS installed, so things like tmux will not be available for you to use. Hence why I like to start off with screen, not that I’m old-skool or anything, I like tmux/tilix more, but trust me, you will get stuck with screen more often than not. |
What is screen? Well, screen is a virtual terminal that allows you to run jobs, even after closing your terminal (continues the process). To demonstrate what I mean, open a terminal and type: evince | What is screen? Well, screen is a virtual terminal that allows you to run jobs, even after closing your terminal (continues the process). To demonstrate what I mean, open a terminal and type: evince | ||
Ligne 5: | Ligne 5: | ||
Your document viewer opens. Now close the terminal and you should get a warning, but close it anyway. What happened to evince? So are we on the same page? The evince process was terminated when your terminal emulator was closed. We don’t want this when working on a remote machine. Imagine you have to zip up log files on remote machines and copy them elsewhere and you also need to go home as it is after five and you would rather not sit around for another hour at work, or you are busy hacking your school computer, running a brute-force attack, but it could take hours and you need to be home by 9, you don’t want to stop dead in the water and start again from scratch tomorrow, you want it to finish. | Your document viewer opens. Now close the terminal and you should get a warning, but close it anyway. What happened to evince? So are we on the same page? The evince process was terminated when your terminal emulator was closed. We don’t want this when working on a remote machine. Imagine you have to zip up log files on remote machines and copy them elsewhere and you also need to go home as it is after five and you would rather not sit around for another hour at work, or you are busy hacking your school computer, running a brute-force attack, but it could take hours and you need to be home by 9, you don’t want to stop dead in the water and start again from scratch tomorrow, you want it to finish. | ||
- | What is nice about screen, is that you can have a few instances running at once and switch between the processes running in each. However, do not assume it is installed. You may need to add it with: sudo apt install screen – on both ends where you intend to use it. The man page for screen is very long, and it uses that emacs type notation for key bindings, that look like this: C-a meaning CTRL+a. (Important, file for later use). | + | What is nice about screen, is that you can have a few instances running at once and switch between the processes running in each. However, do not assume it is installed. You may need to add it with: sudo apt install screen – on both ends where you intend to use it. The man page for screen is very long, and it uses that emacs type notation for key bindings, that look like this: C-a meaning CTRL+a. (Important, file for later use).** |
- | Fire up your terminal and type: | + | Le mois dernier, nous avons approfondi les tâches, les processus de premier plan et d' |
+ | |||
+ | Qu' | ||
+ | |||
+ | Votre visionneuse de documents s' | ||
+ | |||
+ | L' | ||
+ | |||
+ | |||
+ | **Fire up your terminal and type: | ||
screen | screen | ||
Ligne 49: | Ligne 58: | ||
I renamed the middle one, “Centre” and when I bring up my list, I can see it. Your turn. | I renamed the middle one, “Centre” and when I bring up my list, I can see it. Your turn. | ||
- | So now, instead of it just saying “bash”, it has a name and you should see a ‘*’ indicating which screen you are currently on. Start a ping in one of those screens and switch away and go back. | + | So now, instead of it just saying “bash”, it has a name and you should see a ‘*’ indicating which screen you are currently on. Start a ping in one of those screens and switch away and go back.** |
- | If you were wide awake, you may have noticed “detach” in the man page, obviously it is: | + | Lancez votre terminal et saisissez : |
+ | |||
+ | screen | ||
+ | |||
+ | Si vous êtes directement sur un TTY, vous ne devriez pas voir ceci ; c'est comme si rien ne s' | ||
+ | |||
+ | Cependant, nous pouvons vous donner une idée en procédant comme suit : | ||
+ | |||
+ | Saisissez : | ||
+ | |||
+ | echo " | ||
+ | |||
+ | appuyez sur CTRL+a, relâchez les touches et appuyez sur c | ||
+ | |||
+ | echo " | ||
+ | |||
+ | appuyez sur CTRL+a, relâchez les touches et appuyez sur c | ||
+ | |||
+ | echo " | ||
+ | |||
+ | appuyez sur CTRL+a, relâchez les touches et appuyez sur p | ||
+ | |||
+ | appuyez sur CTRL+a, relâchez les touches et appuyez sur n | ||
+ | |||
+ | Que s' | ||
+ | |||
+ | Maintenant : | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur 0 | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur 2 | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur " | ||
+ | |||
+ | Vous devriez pouvoir naviguer avec les flèches haut et bas. | ||
+ | |||
+ | Si vous l' | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur A (A majuscule) et donnez un nom à cet écran. | ||
+ | |||
+ | J'ai renommé celui du milieu « Centre » et lorsque j' | ||
+ | |||
+ | Maintenant, au lieu d' | ||
+ | |||
+ | |||
+ | **If you were wide awake, you may have noticed “detach” in the man page, obviously it is: | ||
press CTRL+a let go of the keys and press d. | press CTRL+a let go of the keys and press d. | ||
Ligne 65: | Ligne 119: | ||
That (detached) message, is the one we just disconnected from, and since it is “recent”, | That (detached) message, is the one we just disconnected from, and since it is “recent”, | ||
- | Try it yourself quickly, I’ll wait.... | + | Try it yourself quickly, I’ll wait....** |
- | One last thing: just like screens, you can also name your sessions (though I have never used it, as usually my session is one screen to one server), and you can bake that into a configuration file, but I feel we are stepping outside newbie territory. When starting a screen session, use -S (capital “S”) followed by a name (I named it FCM). You can also name a session from *inside screen, you just need to list all the open screens first, with: | + | Si vous étiez bien réveillé, vous avez peut-être remarqué « detach » dans la page du manuel, c'est bien ça : |
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur D. | ||
+ | |||
+ | Vous devriez avoir votre invite de commande bash habituelle de retour (certaines distributions, | ||
+ | |||
+ | Maintenant, pour la partie que je souhaite comparer avec ce qui s'est passé avec evince, fermez le terminal. Ouvrez-en un nouveau ; il n'est même pas nécessaire que ce soit un terminal Gnome. | ||
+ | |||
+ | Saisissez maintenant : | ||
+ | |||
+ | screen -ls | ||
+ | |||
+ | Ce message (detach - détaché) est celui dont nous venons de nous déconnecter. Comme il est « récent », | ||
+ | |||
+ | Essayez vite, j' | ||
+ | |||
+ | |||
+ | **One last thing: just like screens, you can also name your sessions (though I have never used it, as usually my session is one screen to one server), and you can bake that into a configuration file, but I feel we are stepping outside newbie territory. When starting a screen session, use -S (capital “S”) followed by a name (I named it FCM). You can also name a session from *inside screen, you just need to list all the open screens first, with: | ||
press CTRL+a let go of the keys and press “ | press CTRL+a let go of the keys and press “ | ||
Ligne 87: | Ligne 158: | ||
And that should cover the basics for any newbie, I really don’t think you will need more in a loooong time, but have a look at the man page, and see that this is a grand daddy page! There are options to fit everyone’s use case. I hope you followed along in your terminal, or it will be forgotten tomorrow. | And that should cover the basics for any newbie, I really don’t think you will need more in a loooong time, but have a look at the man page, and see that this is a grand daddy page! There are options to fit everyone’s use case. I hope you followed along in your terminal, or it will be forgotten tomorrow. | ||
- | Any mistakes, please write to: misc@fullcirclemagazine.org | + | Any mistakes, please write to: misc@fullcirclemagazine.org** |
+ | |||
+ | Une dernière chose : tout comme pour les écrans, vous pouvez nommer vos sessions (même si je ne l'ai jamais utilisé, car, dans ma session, c'est généralement un écran pour un serveur), et vous pouvez l' | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur " | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur : | ||
+ | |||
+ | Vous devriez maintenant voir un « : » en bas du terminal. Saisissez nom_session (un mot). | ||
+ | |||
+ | Commencez à nommer et appuyez sur < | ||
+ | |||
+ | Maintenant, la partie amusante, pour fermer un écran : | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur K. | ||
+ | |||
+ | Et pour « killall », | ||
+ | |||
+ | Appuyez sur CTRL+a, relâchez les touches et appuyez sur \. | ||
+ | |||
+ | Voilà qui devrait couvrir les bases pour les débutants. Je ne pense pas que vous en aurez besoin de plus avant looooongtemps, | ||
+ | |||
+ | En cas d’erreur, veuillez écrire à : misc@fullcirclemagazine.org | ||
issue215/c_c.1743256243.txt.gz · Dernière modification : 2025/03/29 14:50 de auntiee