Project

General

Profile

Feature #524

Updated by Daniel Curtis almost 10 years ago

{{>toc}} 

 From time to time I need to compile a program and close my ssh session, and doing this will kill all running processes spawned from the session it was created from. Luckily there is a handy tool called @tmux@ that will keep processes launched from within the tmux session from dying, even after logging out (as long as the system is running). 

 h1 Tmux 

 h2. Install tmux 

 * On Debian/Ubuntu 
 <pre> 
 apt-get install tmux 
 </pre> 

 * On Arch 
 <pre> 
 pacman -S tmux 
 </pre> 

 * On FreeBSD 
 <pre> 
 pkg install tmux 
 </pre> 

 h2. Running tmux 

 * Once installed, spawn a tmux session: 
 <pre> 
 tmux 
 </pre> 

 * Now run what ever process that takes a long time: 
 <pre> 
 cd /usr/src/project 
 make 
 </pre> 

 * While the process is running press +@Ctrl + b@+, B@+, then +@d@+. +@D@+. 

 * Then reattach the session to view its progress: 
 <pre> 
 tmux attach 
 </pre> 

 * To list the running tmux sessions, run: 
 <pre> 
 tmux list-sessions 
 </pre> 

 h1. Screen 

 h2. Install screen 

 * On Debian/Ubuntu 
 <pre> 
 apt-get install screen 
 </pre> 

 * On Arch 
 <pre> 
 pacman -S screen 
 </pre> 

 * On FreeBSD 
 <pre> 
 pkg install screen 
 </pre> 

 h2. Running screen 

 * Once installed, spawn a tmux session: 
 <pre> 
 screen 
 </pre> 

 * Now run what ever process that takes a long time: 
 <pre> 
 cd /usr/src/project 
 make 
 </pre> 

 * While the process is running press +@Ctrl + a@+, then +@d@+. 

 * Then reattach the session to view its progress: 
 <pre> 
 screen -r 
 </pre>

Back