While using tmux, you work with three components of the application. These three components are: “sessions”, “panes” and “windows”. Further descriptions of the three components are as follows.
- Sessions: whenever you want to use tmux, you need to start a new “session” in which you perform the task at hand.
- Windows: windows are used within a session to work on the different tasks.
- Panes: these are used to divide the windows so that you can perform different tasks in multiple windows.
In this article, we will be discussing tmux windows in detail. Also, the set of different commands that are used while working with tmux windows and how you can manage them when you divide them into panes. Continue reading to find out everything you need to know about managing tmux on windows.
How to Control tmux?
While using tmux, there are different ways you can enter the tmux-specific commands. The three different ways are as follows:
1. You can instruct tmux with what you want it to do by pressing “Ctrl+b“ followed by a command-specific key. For example, if you want to close a tmux window, it can be done by pressing “Ctrl+b+&”.
2. The second way of controlling tmux is using a command line that pops up at the bottom of the window while using tmux. To get the popped-up command line, press “Ctrl+b+:”. In the command line, you can enter the tmux-specific commands such as “resize-pane -z”. The said command will let you zoom in on the pane to have a better look at what is written.
3. The third way you can instruct tmux is by entering commands on the command terminal itself. While working in a tmux session, you can enter the commands in the terminal window you are working on. For these commands to execute, you need to prefix each command with “tmux”. For example, if you want to create a new tmux session, enter the following command in the terminal:
Common Commands Used to Manage tmux Windows and Panes
After discussing the ways you can instruct tmux, let’s move on to the commands that are used to control tmux windows and panes. After starting a new tmux session by using the command mentioned above, you can use the following commands:
1. You can use this command to split the windows into panes. You can split the windows both vertically and horizontally. Use the following commands to do just that:
Press “ Ctrl+b+” ” to split horizontally.
Press “ Ctrl+b+% “ to split vertically.
2. Each tmux window and pane are numbered. To access different windows and panes, there is the provision of moving between them and you can use the numbers to access them. These are the following ways you can move between panes:
- Press “Ctrl+b+q” and press a number key that matches the number of the window you want to move to.
- You can also use “Ctrl+b+n” to move to the next window and “Ctrl+b+p” to move to the previous window.
- You can also use “Ctrl+b+n” to move to the next window and “Ctrl+b+p” to move to the previous window.
- To move to the pane on the left of the current pane, use “Ctrl+b+}” and to move to the right use “Ctrl+b+{“.
- To move to the pane being used previously, use “Ctrl+b:”.
3. To rename a window, you can use press “Ctrl+b+,” and then write the new name.
4. To display the list of windows that have been made, you can press “Ctrl+b+w”.
5. You can use different commands to resize tmux panes. First, you need to make the command line pop up using “Ctrl+b+:” and then enter the commands. The commands are as follows:
- $ resize-pane -D. This command moves the pane boundary downward.
- $ resize-pane -U. This command moves the pane boundary upward.
- $ resize-pane -L. This command moves the boundary towards the left.
- $ resize-pane -R. This command moves the boundary towards the right.
You can also specify the size of the pane you want to be resized.
- $ resize-pane -R 5. This command will move the boundary 5 cells to the right.
You can also choose to resize a pane which you are not currently working on.
- $ resize-pane -2 -R 5. This will move the boundary of pane 2 5 cells towards the right.
6. Usually, the commands you enter work on the pane you are currently working on. Yes, you can specify the command to be executed on an “unselected” pane. But in the case you want to apply the commands to all the panes simultaneously, use the following command:
Press “Ctrl+b” and then enter this command:
After this, any command you enter will be executed on all the panes.
7. To change the color of the status bar appearing on the windows, you can open the configuration file for editing it.
After opening the file, add the following script to it:
set –g status-bg blue
set –g status-fg black
So, this was a list of the common commands that you will use to manage different windows and panes. There are different options available for both windows and panes to be configured the way you would like them to be.
Conclusion
This was an article on how to manage the windows and panes you create while using tmux. We looked at the different commands that you use for managing them. Refer to the methods mentioned above whenever you find managing tmux on windows difficult.
from https://ift.tt/eTIcxl3
0 Comments