Multiplex and Process Detachment ================================ * ``screen`` * ``tmux`` .. code-block:: bash # screen tool # -d detached, -m create new terminal, -S to give the session a name, -dmS screen -dmS sx_tail tail -f /var/log/dmesg # tail without the -f will naturally exit screen -dmS sx_tail tail /var/log/dmesg # can call with sudo screen -dmS sx_system bash -c "sudo systemctl status NetworkManager" # update and upgrade screen -dmS sx_update bash -c "sudo apt -y update && sudo apt -y upgrade" # stopping the detached processes by their names screen -S sx_tail -X quit screen -S sx_system -X quit ssh mk@nuc 'screen -dmS sx_tail tail -f /var/log/dmesg' # for each active, named screen sessions, quit each one for k in $(screen -ls | python -m xbin.screen_split); do screen -S $k -X quit; done #Tmux tool similar to screen tmux new-session -d -s tx_tail "bash -c 'tail -f /var/log/dmesg'" # run in background tmux list-sessions tmux attach-session -t tx_tail # atach session by name tmux kill-session -t tx_tail # kill a session by name