issue126:tutoriel2
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue126:tutoriel2 [2017/10/29 18:20] – créée auntiee | issue126:tutoriel2 [2017/11/11 15:32] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | In the previous article, we have learnt what is tmux, and how to install and start it. Now it is time to begin the real usage of this amazing tool. We are going to learn how to send commands to the program, how to manage different sessions, and how to organize our workspace with windows and panes. | + | **In the previous article, we have learnt what is tmux, and how to install and start it. Now it is time to begin the real usage of this amazing tool. We are going to learn how to send commands to the program, how to manage different sessions, and how to organize our workspace with windows and panes.** |
- | Command tmux | + | Dans l' |
+ | |||
+ | **Command tmux | ||
The tmux is an application framework that can run several virtual terminals inside. As users, we can run several command-line programs inside these virtual terminals. Therefore it is an essential need to be able to send any commands directly to tmux without disturbing the running virtual terminals and programs. | The tmux is an application framework that can run several virtual terminals inside. As users, we can run several command-line programs inside these virtual terminals. Therefore it is an essential need to be able to send any commands directly to tmux without disturbing the running virtual terminals and programs. | ||
In order to achieve this goal, tmux uses the so-called " | In order to achieve this goal, tmux uses the so-called " | ||
+ | |||
The exact usage is: | The exact usage is: | ||
• type the prefix combination | • type the prefix combination | ||
Ligne 13: | Ligne 16: | ||
Let's try it with an example. Start tmux and type the following: <Ctrl-b t> (press " | Let's try it with an example. Start tmux and type the following: <Ctrl-b t> (press " | ||
- | From now on, we will use the “Prefix” word instead of " | + | From now on, we will use the “Prefix” word instead of " |
- | Session handling | + | La commande tmux |
+ | |||
+ | tmux est un framework d' | ||
+ | |||
+ | Pour y arriver, tmux utilise ce qu'il appelle un « préfixe de commande ». Sa valeur par défaut est < | ||
+ | |||
+ | L' | ||
+ | • taper la combinaison de touches, | ||
+ | • relâcher les touches, | ||
+ | • appuyer immédiatement sur la touche de commande. | ||
+ | |||
+ | Essayons avec un exemple. Démarrez tmux et tapez la commande suivante : <Ctrl-b t> (appuyez sur « Ctrl-b » puis appuyez sur « t»). Vous devez voir une horloge digitale bleue au milieu de l' | ||
+ | |||
+ | À partir de maintenant, nous utiliserons le mot « Préfixe » au lieu de « Ctrl-b ». L' | ||
+ | |||
+ | **Session handling | ||
The most powerful feature of tmux is the session handling. In a normal terminal environment, | The most powerful feature of tmux is the session handling. In a normal terminal environment, | ||
Ligne 24: | Ligne 42: | ||
or | or | ||
+ | |||
+ | $ tmux new -s Temp** | ||
+ | |||
+ | Gestion d'une session | ||
+ | |||
+ | La fonctionnalité la plus puissante de tmux est la gestion des sessions. Dans l' | ||
+ | |||
+ | Pour gérer les sessions, tmux doit être démarré avec les commandes suivantes : | ||
+ | |||
+ | $ tmux new-session -s Temp | ||
+ | |||
+ | ou | ||
$ tmux new -s Temp | $ tmux new -s Temp | ||
- | This will create a new session called Temp, and it will automatically attach to it. Almost everything will be the same as in a normal starting of tmux without session handling, except that the name of the session can be read on the first place of the status bar. The picture shows the previously mentioned digital clock in a named session. If -d is used at the end of the new session command, then the session will be created but it will not attach to it automatically. | + | |
+ | **This will create a new session called Temp, and it will automatically attach to it. Almost everything will be the same as in a normal starting of tmux without session handling, except that the name of the session can be read on the first place of the status bar. The picture shows the previously mentioned digital clock in a named session. If -d is used at the end of the new session command, then the session will be created but it will not attach to it automatically. | ||
First of all, run again the clock command <Prefix b>. Now we have an opened session inside tmux. If we were to type the command “exit”, then tmux would terminate this session and we would not be able to attach again. Therefore we have to use the detach command: <Prefix d>. We can see the terminal output: | First of all, run again the clock command <Prefix b>. Now we have an opened session inside tmux. If we were to type the command “exit”, then tmux would terminate this session and we would not be able to attach again. Therefore we have to use the detach command: <Prefix d>. We can see the terminal output: | ||
+ | |||
+ | [detached (from session Temp)]** | ||
+ | |||
+ | Ceci créera une nouvelle session nommée Temp et il s' | ||
+ | |||
+ | Tout d' | ||
[detached (from session Temp)] | [detached (from session Temp)] | ||
- | This message means that we have an opened session. In order to list all of the available sessions, just type the following command: | + | **This message means that we have an opened session. In order to list all of the available sessions, just type the following command: |
$ tmux list-session | $ tmux list-session | ||
Ligne 43: | Ligne 80: | ||
$ tmux attach -t Temp | $ tmux attach -t Temp | ||
- | Now we get the same session “Temp” with the already running clock. | + | Now we get the same session “Temp” with the already running clock.** |
- | We can use more sessions as well. Detach from the currently running “Temp” session, start a new one with name “Pmet”, detach from it, and finally get the list of the sessions again: | + | |
+ | Ce message signifie que nous avons une session ouverte. Pour lister toutes les sessions disponibles, | ||
+ | |||
+ | $ tmux list-session | ||
+ | |||
+ | Temp: 1 windows (created Sat Jun 10 21:38:16 2017) [80x23] | ||
+ | |||
+ | La version raccourcie peut aussi être utilisée (ls). Le résultat indique que nous avons une session ouverte, nommée « Temp », avec une seule fenêtre (des informations complémentaires peuvent aussi être lues). Maintenant, essayons de rattacher cette session : | ||
+ | |||
+ | $ tmux attach -t Temp | ||
+ | |||
+ | Maintenant, nous retrouvons la même session « Temp » avec l' | ||
+ | |||
+ | **We can use more sessions as well. Detach from the currently running “Temp” session, start a new one with name “Pmet”, detach from it, and finally get the list of the sessions again: | ||
[detached (from session Temp)] | [detached (from session Temp)] | ||
Ligne 61: | Ligne 111: | ||
no server running on / | no server running on / | ||
- | That was all about the session handling. Let’s jump to the window handling. | + | That was all about the session handling. Let’s jump to the window handling.** |
- | Window handling | + | Nous pouvons utiliser aussi des sessions en plus. Détachez la session « Temp » tournant actuellement, |
+ | |||
+ | [detached (from session Temp)] | ||
+ | $ tmux new -s Pmet | ||
+ | [detached (from session Pmet)] | ||
+ | $ tmux ls | ||
+ | Temp: 1 windows (created Sat Jun 10 21:38:16 2017) [80x23] | ||
+ | Pmet: 1 windows (created Sat Jun 10 21:40:42 2017) [80x23] | ||
+ | |||
+ | Si une session n'est plus du tout utile, il y a deux façons de la terminer. La méthode (1) peut être exécutée dans tmux, simplement en s' | ||
+ | |||
+ | $ tmux kill-session -t Temp | ||
+ | |||
+ | Après avoir tué toutes les sessions, nous obtiendrons la sortie suivante de la commande de liste des sessions : | ||
+ | |||
+ | no server running on / | ||
+ | |||
+ | Ce sera tout sur la gestion des sessions. Passons à la gestion des fenêtres. | ||
+ | |||
+ | **Window handling | ||
Windows inside a session are very similar to the tabs of a text editor or a web browser. Each and every windows are able to run different (or the same) commands. After detaching from a running session, all of the opened windows will keep running the started application in the background. | Windows inside a session are very similar to the tabs of a text editor or a web browser. Each and every windows are able to run different (or the same) commands. After detaching from a running session, all of the opened windows will keep running the started application in the background. | ||
- | When we start a new tmux session, the name of the window (the word after the number of the window) will be the currently running application by default, and it is changed every time when we start a new command. Right after starting tmux, it will be the name of our bash. If we start the top application, | + | When we start a new tmux session, the name of the window (the word after the number of the window) will be the currently running application by default, and it is changed every time when we start a new command. Right after starting tmux, it will be the name of our bash. If we start the top application, |
+ | |||
+ | Gestion des fenêtres | ||
+ | |||
+ | Les fenêtres dans une session sont très similaires aux onglets dans un éditeur de texte ou un navigateur Web. Chaque fenêtre est capable de faire tourner des commandes différentes (ou les mêmes). Après avoir été détachées d'une session en cours, toutes les fenêtres ouvertes continueront de faire tourner en tache de fond les applications lancées. | ||
+ | |||
+ | Quand nous commençons une nouvelle session tmux, le nom de la fenêtre (le mot après le numéro de la session) sera par défaut celui de l' | ||
- | In order to avoid the continuous name change, the window name has to be defined explicitly. This can be done in two ways: (a) at the same time when we start the tmux, (b) inside tmux by a command. | + | **In order to avoid the continuous name change, the window name has to be defined explicitly. This can be done in two ways: (a) at the same time when we start the tmux, (b) inside tmux by a command. |
The method (a) is: | The method (a) is: | ||
Ligne 77: | Ligne 152: | ||
This terminal command starts tmux with a session (-s) named temp_w, and with a window (-n) named first. Now, if we run the top command, the name of the window will remain temp_w. | This terminal command starts tmux with a session (-s) named temp_w, and with a window (-n) named first. Now, if we run the top command, the name of the window will remain temp_w. | ||
- | The method (b) is to run the following command inside tmux: <Prefix ,> (comma). By performing the command, the status bar will be active and the name of the window can be modified. | + | The method (b) is to run the following command inside tmux: <Prefix ,> (comma). By performing the command, the status bar will be active and the name of the window can be modified.** |
- | A brand new window can be created inside tmux with the command <Prefix c>. It has no defined name, but this can be changed by the command mentioned previously. | + | Pour éviter un changement permanent de nom, le nom de la fenêtre doit être défini explicitement. Ceci peut être fait de deux manières : (a) en même temps que nous démarrons tmux, (b) dans tmux par une commande. |
- | There is no limitation on the amount of windows in tmux. In the picture, three windows have been created inside session temp_w: | + | La méthode (a) est : |
- | There are several ways to change between the windows. The active window is always marked with * character after the name of the window in the status bar. The – character signs the previously used window. Method (1) is to use the < | + | $ tmux new -s temp_w -n first |
- | All of the windows have a unique identifier - starting with 0. Method (2) is to use the <Prefix w_number> | + | |
- | Finally, method | + | Cette commande de terminal démarre tmux avec une session (-s) nommée temp_w, et avec une fenêtre |
- | In order to close one window, the exit command can be used. This will terminate the active window without any questions. The safer method is to use the <Prefix &> command. This will request a confirmation in the status bar before killing the active | + | La méthode (b) consiste à lancer la commande suivante dans tmux : < |
- | Pane handling | + | **A brand new window can be created inside tmux with the command <Prefix c>. It has no defined name, but this can be changed by the command mentioned previously. |
- | The usage of multiple | + | There is no limitation on the amount |
- | Now, it is easy to open a vim editor | + | There are several ways to change between the windows. The active window is always marked with * character after the name of the window |
- | Moving between the panes can be performed with two methods. Method (1) is to use the <Prefix o> command, this will go through the panes continuously. Method (2) is to use the <Prefix arrow_keys> | + | Une toute nouvelle fenêtre peut être créée dans tmux par la commande |
- | In order to close one pane, the exit command can be used. This will terminate the pane without any questions. The safer method is to use the <Prefix x> command. This will request a confirmation in the status bar before killing the active pane. Terminating the last pane will also close the active window, and, if it is the last window, then the entire | + | Le nombre de fenêtres dans tmux n'est pas limité. Sur l' |
- | Conclusion | + | Il y a plusieurs façons de passer d'une fenêtre à l' |
- | This article covers | + | **All of the windows have a unique identifier - starting with 0. Method (2) is to use the <Prefix w_number> |
+ | Finally, method (3) is to use the <Prefix w> command. This will list all of the available windows as a visual menu, and the desired one can be chosen with the arrow keys. | ||
+ | In order to close one window, the exit command can be used. This will terminate the active window without any questions. The safer method is to use the <Prefix &> command. This will request a confirmation in the status bar before killing the active window. Terminating the last window will also close the session.** | ||
+ | Chaque fenêtre a un identifiant unique - commençant à 0. Dans la méthode (2), la commande < | ||
+ | Enfin, dans la méthode (3), la commande < | ||
+ | Pour fermer une fenêtre, la commande exit peut être utilisée. Celle-ci terminera la fenêtre active sans aucune question. La méthode plus sûre est l' | ||
+ | **Pane handling | ||
+ | The usage of multiple windows is quite useful, but still not the best way to manage different tasks at the same time. If parallel monitoring of the tasks is important, then panes will be our best friend. Let’s start a new session named temp_p. Any window can be split vertically and/or horizontally. For vertical split, use the <Prefix %> command. For horizontal split, use the <Prefix “> (double quote) command. The window looks like in the picture: | ||
+ | Now, it is easy to open a vim editor in the left pane to edit a source file of an embedded application, | ||
+ | Moving between the panes can be performed with two methods. Method (1) is to use the <Prefix o> command, this will go through the panes continuously. Method (2) is to use the <Prefix arrow_keys> | ||
+ | Gestion des panneaux | ||
+ | L' | ||
+ | Maintenant, il est facile d' | ||
+ | Deux méthodes existent pour passer d'un panneau à l' | ||
+ | **In order to close one pane, the exit command can be used. This will terminate the pane without any questions. The safer method is to use the <Prefix x> command. This will request a confirmation in the status bar before killing the active pane. Terminating the last pane will also close the active window, and, if it is the last window, then the entire session will be closed as well. | ||
+ | Conclusion | ||
+ | |||
+ | This article covers the most important topics regarding tmux. Now we can use it as our main development environment as programmers, | ||
+ | |||
+ | Pour fermer un panneau, la commande exit peut être utilisée. Celle-ci fermera le panneau sans aucune question. La méthode plus sûre est d' | ||
+ | |||
+ | Conclusion | ||
+ | Cet article couvre les points les plus importants concernant tmux. Maintenant, nous pouvons l' | ||
- | Command Reference | + | **Command Reference |
tmux new-session -s < | tmux new-session -s < | ||
Ligne 136: | Ligne 232: | ||
tmux list-session | tmux list-session | ||
- | List all of the opened sessions | + | List all of the opened sessions** |
- | + | ||
- | tmux ls | + | |
- | (Shorter) List all of the opened sessions | + | |
- | + | ||
- | tmux kill-session -t < | + | |
- | Terminate (destroy) an already opened session | + | |
+ | Référentiel des commandes | ||
+ | tmux new-session -s < | ||
+ | Démarre une nouvelle session avec un nom précisé. | ||
+ | tmux new -s < | ||
+ | (Plus court.) Démarre une nouvelle session avec un nom précisé. | ||
+ | tmux new -s < | ||
+ | (Plus court.) Démarre une nouvelle session et une nouvelle fenêtre avec des noms précisés. | ||
+ | tmux attach -t < | ||
+ | Aller dans une session déjà ouverte dont le nom est défini. | ||
+ | tmux list-session | ||
+ | Lister toutes les sessions ouvertes. | ||
+ | **tmux ls | ||
+ | (Shorter) List all of the opened sessions | ||
+ | tmux kill-session -t < | ||
+ | Terminate (destroy) an already opened session | ||
Ctrl-B & Command Prefix | Ctrl-B & Command Prefix | ||
Ligne 162: | Ligne 266: | ||
Prefix , | Prefix , | ||
- | Rename a window in the status bar | + | Rename a window in the status bar** |
+ | |||
+ | tmux ls | ||
+ | (Plus court.) Lister toutes les sessions ouvertes. | ||
+ | |||
+ | tmux kill-session -t < | ||
+ | Terminer (détruire) une session déjà ouverte. | ||
+ | |||
+ | Ctrl-B & le Préfixe de commande. | ||
+ | |||
+ | Préfixe t | ||
+ | Afficher l' | ||
+ | |||
+ | Préfixe c | ||
+ | Créer une nouvelle fenêtre. | ||
+ | |||
+ | Préfixe , | ||
+ | Renommer une fenêtre dans la barre d' | ||
- | Prefix n | + | **Prefix n |
Go to the next window | Go to the next window | ||
Ligne 177: | Ligne 298: | ||
Prefix & | Prefix & | ||
- | Close the active window with confirmation | + | Close the active window with confirmation** |
- | Prefix % | + | Préfixe n |
+ | Passer à la fenêtre suivante. | ||
+ | |||
+ | Préfixe p | ||
+ | Passer à la fenêtre précédente. | ||
+ | |||
+ | Préfixe w_number | ||
+ | Aller à la fenêtre w_number. | ||
+ | |||
+ | Préfixe w | ||
+ | Lister les fenêtres ouvertes dans un menu affiché. | ||
+ | |||
+ | Préfixe & | ||
+ | Fermer la fenêtre active avec confirmation. | ||
+ | |||
+ | **Prefix % | ||
Split the active window vertically | Split the active window vertically | ||
Ligne 192: | Ligne 328: | ||
Prefix x | Prefix x | ||
- | Close the active pane with confirmation | + | Close the active pane with confirmation** |
+ | |||
+ | Préfixe % | ||
+ | Couper la fenêtre active en deux verticalement. | ||
+ | |||
+ | Préfixe “ | ||
+ | Couper la fenêtre active en deux horizontalement. | ||
+ | |||
+ | Préfixe o | ||
+ | Passer sur le panneau suivant. | ||
+ | |||
+ | Préfixe touche fléchée | ||
+ | Passer sur le panneau souhaité. | ||
+ | |||
+ | Préfixe x | ||
+ | Fermer le panneau actif avec confirmation. |
issue126/tutoriel2.1509297620.txt.gz · Dernière modification : 2017/10/29 18:20 de auntiee