Skip to content

Instantly share code, notes, and snippets.

@pablotrianda
Created September 4, 2023 12:07
Show Gist options
  • Save pablotrianda/7eed2c32859e646f78d7157ce5ce3242 to your computer and use it in GitHub Desktop.
Save pablotrianda/7eed2c32859e646f78d7157ce5ce3242 to your computer and use it in GitHub Desktop.
Bash script to launch a new tmux session with 2 windows
#!/bin/bash
# Create a new session called "πŸ’»πŸ”₯"
tmux new-session -d -s πŸ’»πŸ”₯
# Crate the first window and run vim
tmux new-window -t πŸ’»πŸ”₯:1 -n "NOTES"
#Open vim with the last note
tmux send-keys "v ~/Notes/$(ls /home/pablo/Notes | sort | tail -n 1)/$(ls ~/Notes/$(ls /home/pablo/Notes | sort | tail -n 1) | sort | tail -n 1)" C-m
# Crate the second one
tmux new-window -t πŸ’»πŸ”₯:2 -n "BACKEND"
# Chage to work directory
tmux send-keys "mbody" C-m
# Ejecutar htop en el panel de abajo
tmux send-keys "files" C-m
# Split second window
tmux split-window -v -t πŸ’»πŸ”₯:2
# Chage to work directory
tmux send-keys "mbody" C-m
# Clean window
tmux send-keys "clear" C-m
# Chage focus to the fisrt window
tmux select-window -t πŸ’»πŸ”₯:1
# Attach to the new session
tmux attach -t πŸ’»πŸ”₯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment