Easily create and manage tmux sessions with predefined directory and pane setup.
- Automatically create a tmux session: Quickly set up a new session for your projects.
- Open a project directory on startup: Start your session in the desired directory.
- Split panes into a structured workspace: Organize your workspace with multiple panes.
Clone this repository:
git clone https://github.com/YOUR_USERNAME/tmux-sessionizer.git
cd tmux-sessionizer
Make the script executable:
chmod +x tmux-session.sh
Optionally, add the script to your system's PATH or create an alias for easier access (see below).
Edit the script: Modify tmux-session.sh to set your desired session name and project directory.
SESSION_NAME="my_session"
WORK_DIR="$HOME/repos/my_project" # Change this to your project path
Run the script: Execute the script to create and attach to your tmux session.
./tmux-session.sh
- Open your shell configuration file (e.g., .bashrc, .zshrc).
- Add the following line to create an alias:
alias tmux-session='~/path/to/tmux-sessionizer/tmux-session.sh'
- Replace
~/path/to/tmux-sessionizer/
with the actual path to your cloned repository. - Restart your terminal or run
source ~/.bashrc
(orsource ~/.zshrc
) to apply the changes. - Use the alias: Now you can run your script using the alias:
tmux-session
The script performs the following operations:
- Checks if a tmux session with the specified name already exists
- If the session exists, it attaches to it. Otherwise, it creates a new session
- The session starts in the specified project directory
- The script splits the window into multiple panes for a structured workspace