Introduction to tmux
Summary
TLDRThis tutorial walks viewers through using TMUX, a powerful terminal multiplexer, to manage terminal sessions effectively. The video covers essential features like session persistence, window splitting, and custom keybindings. The speaker demonstrates how TMUX enables multitasking by splitting windows vertically and horizontally, navigating easily between them, and keeping processes running even when an SSH connection disconnects. Key customization tips include reconfiguring the prefix key, enabling VI-style search and navigation, and using the logging plugin to capture terminal output. TMUXβs versatility makes it an invaluable tool for sysadmins, penetration testers, and anyone managing multiple terminal sessions.
Takeaways
- π tmux's biggest benefit is its ability to keep processes running even if your SSH connection dies, allowing you to reconnect to your session without losing progress.
- π To start a new tmux session, use `tmux new -s [session-name]`. This helps organize tasks into specific windows, like `htb` for Hack The Box challenges.
- π Window management is simple in tmux; you can create new windows with `prefix + C` and switch between them with `prefix + [0-9]`.
- π Rebinding the tmux prefix key to `Ctrl+A` (the default for `screen`) can make it easier for users transitioning between terminal multiplexers.
- π tmux's window splitting feature allows you to create both vertical and horizontal splits with `prefix + %` and `prefix + '` respectively, enabling multi-tasking in one window.
- π The `history-limit` setting in tmux can be increased to 10,000 lines for a larger scrollback buffer, helping to retain more terminal output for review.
- π Enabling `vi` key bindings in tmux allows for efficient search and navigation within your terminal output, making it easier to find and scroll through previous commands.
- π tmuxβs `copy mode` allows users to scroll back through output, select text, and copy it to a buffer for later use or pasting into other applications.
- π The logging feature (`prefix + Alt+Shift+P`) is extremely helpful for capturing the output of long-running commands or penetration tests to avoid losing important data.
- π tmux's productivity-enhancing shortcuts include cycling through command history with `Ctrl+R`, and using `Alt+.` to repeat previous command arguments, saving time during repetitive tasks.
Q & A
What is the main benefit of using tmux, as mentioned in the video?
-The main benefit of using tmux is its ability to keep terminal windows running as separate processes. This means if an SSH connection is lost, the processes continue running in the background, and the user can reconnect to the session and pick up where they left off.
Why does the presenter rebind the tmux prefix key from Ctrl+B to Ctrl+A?
-The presenter rebinds the prefix key to Ctrl+A because they previously used screen, where the prefix key was Ctrl+A. This also allows for nested tmux sessions, as the user can start a tmux session within another tmux session.
What is the purpose of setting the scrollback buffer to 10,000 lines in tmux?
-Setting the scrollback buffer to 10,000 lines allows for easier navigation through the terminal history, enabling users to review a larger amount of past output without running into limitations on how much history can be stored.
How does tmux's logging feature benefit users, particularly in penetration testing or sysadmin tasks?
-The logging feature in tmux allows users to save the output from a tmux pane to a file. This is especially useful for capturing important terminal outputs, such as Nmap scans or passwords, which can be lost if the session is closed or if the user forgets to save them manually.
How can users split the terminal into multiple panes in tmux?
-Users can split the terminal into vertical or horizontal panes using the prefix key (Ctrl+A) followed by the percent sign for a vertical split or double-quote for a horizontal split. This allows users to run multiple commands simultaneously in different sections of the same window.
What does the 'zoom' feature in tmux do, and how is it activated?
-The 'zoom' feature in tmux allows users to expand one pane to full screen while temporarily hiding the others. This is activated by pressing the prefix key (Ctrl+A) followed by 'Z'. Pressing the same key combination again returns the layout to the previous state.
How can users cycle through windows and panes in tmux?
-Users can cycle through windows by pressing the prefix key followed by a number (e.g., Ctrl+A 1 for window 1). To navigate between panes, users can use the prefix key and the arrow keys or resize panes by holding Ctrl while pressing the arrow keys.
What is the purpose of the 'prefix key' in tmux, and what does it allow users to do?
-The prefix key in tmux is used to trigger tmux-specific commands, such as creating new windows or switching between panes. By default, it is Ctrl+B, but it can be remapped to other key combinations (e.g., Ctrl+A) for customization.
What is the difference between 'tmux' and 'Terminator' as suggested in the video?
-Terminator is recommended for users who only need terminal splitting features, as it provides a more straightforward interface with additional options for managing split windows. However, tmux offers more advanced features, like keeping processes running in the background, which makes it more suitable for long-running tasks in sysadmin and penetration testing scenarios.
How does the presenter use the 'Ctrl+A' combination with the squiggly brackets in tmux?
-The presenter uses 'Ctrl+A' followed by left or right squiggly brackets ('{', '}') to move windows within the tmux layout. This allows them to reorder windows in the desired layout, facilitating better workspace organization.
Outlines
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowMindmap
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowKeywords
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowHighlights
This section is available to paid users only. Please upgrade to access this part.
Upgrade NowTranscripts
This section is available to paid users only. Please upgrade to access this part.
Upgrade Now5.0 / 5 (0 votes)