Start command in a detached screen with logging to file, example captures pod logs in the background:screen -dmS screen_name bash -c 'kubectl logs -f pod_name | tee /home/user/log.txt';
Close all detached screens:
screen -ls | grep ‘(Detached)’ | awk ‘sys {screen -S $1 -X quit}’