App Management Workflow
Tmux is excellent for managing running applications — web servers, WordPress sites, Docker containers, and databases — from a single organized terminal.
Use Case
A structured app management session gives you shell access, logs, monitoring, and tool panes in one persistent workspace.
WordPress / PHP App Session
~/bin/wp-session.sh
#!/bin/bash
SESSION="wordpress"
WP_DIR="/srv/wordpress"
tmux has-session -t "$SESSION" 2>/dev/null && tmux attach -t "$SESSION" && exit
# Session
tmux new -s "$SESSION" -n "shell" -d
tmux send-keys -t "$SESSION:shell" "cd $WP_DIR" Enter
# Window: logs
tmux new-window -t "$SESSION" -n "logs"
tmux split-window -v -t "$SESSION:logs"
tmux send-keys -t "$SESSION:logs.0" "tail -f /var/log/nginx/error.log" Enter
tmux send-keys -t "$SESSION:logs.1" "tail -f /var/log/php8.2-fpm.log" Enter
# Window: database
tmux new-window -t "$SESSION" -n "db"
tmux send-keys -t "$SESSION:db" "mysql -u wordpress -p wordpress" Enter
# Window: monitoring
tmux new-window -t "$SESSION" -n "monitor"
tmux split-window -h -t "$SESSION:monitor"
tmux send-keys -t "$SESSION:monitor.0" "watch -n 5 systemctl status nginx php8.2-fpm" Enter
tmux send-keys -t "$SESSION:monitor.1" "htop" Enter
tmux select-window -t "$SESSION:shell"
tmux attach -t "$SESSION"
Docker Management Session
~/bin/docker-session.sh
#!/bin/bash
SESSION="docker"
tmux has-session -t "$SESSION" 2>/dev/null && tmux attach -t "$SESSION" && exit
tmux new -s "$SESSION" -n "ps" -d
tmux send-keys -t "$SESSION:ps" "watch -n 3 docker ps" Enter
tmux new-window -t "$SESSION" -n "logs"
tmux send-keys -t "$SESSION:logs" "docker compose logs -f" Enter
tmux new-window -t "$SESSION" -n "exec"
# ready for docker exec commands
tmux select-window -t "$SESSION:exec"
tmux attach -t "$SESSION"
General Web Server Session
~/bin/webserver-session.sh
#!/bin/bash
SESSION="webserver"
tmux has-session -t "$SESSION" 2>/dev/null && tmux attach -t "$SESSION" && exit
tmux new -s "$SESSION" -n "nginx" -d
# Window layout: side-by-side access + error logs
tmux split-window -h -t "$SESSION:nginx"
tmux send-keys -t "$SESSION:nginx.0" "tail -F /var/log/nginx/access.log" Enter
tmux send-keys -t "$SESSION:nginx.1" "tail -F /var/log/nginx/error.log" Enter
# Separate window for service status
tmux new-window -t "$SESSION" -n "status"
tmux send-keys -t "$SESSION:status" "watch -n 5 systemctl status nginx" Enter
# Admin shell
tmux new-window -t "$SESSION" -n "admin"
tmux select-window -t "$SESSION:admin"
tmux attach -t "$SESSION"
Recommended Window Structure for Apps
| Window | Purpose | Typical Contents |
|---|---|---|
shell | Primary working shell | cd to app dir, general commands |
logs | Live log viewing | tail -F on app/server logs |
db | Database client | mysql, psql, sqlite3 |
monitor | Resource monitoring | htop, watch commands |
admin | Management tasks | systemctl, docker, wp-cli |
Tips for App Management
- Name all windows — use
tmux rename-windowfor clarity - Use tail -F not
tail -f— follows log rotation automatically - Zoom in on important panes —
Ctrl+b zto focus, zoom again to return - Keep admin shell separate — don't mix commands in a log-watching pane