Let's say i'm running a comand using:
ssh user@ip screen -dm cat file
or a command like:
ssh user@ip screen -dm -S sessionname cat file
Why, in both cases I can't see active screen sessions and so, the output of cat command?
I'm doing: screen -ls or screen -x sessionname but I don't see active sessions.

  • Did you try "ssh user@ip screen -ls" ? – Gerard H. Pille Jun 25 '18 at 22:52
  • Yes, I tried, it print: No Sockets found. What happen is that execution terminate, and so, session ends. I found similar question here: unix.stackexchange.com/questions/47271/… But even following these suggestions, I'm still not able to perform for example cat filename keeping program output, in the session, instead, using top; exec bash (as suggested in posted link), it keeps running. – dvdvhs Jun 25 '18 at 23:01
  • Ah yes, when a session terminates it is quite often no longer active. – Gerard H. Pille Jun 25 '18 at 23:05
  • But if I run: ssh user@ip screen -dmS session_name sh -c 'cat filename; exec bash' Doesn't work, instead, for example, the following works: ssh user@ip screen -dmS session_name sh -c 'top; exec bash' Why? – dvdvhs Jun 25 '18 at 23:08
  • If I run in my local machine: screen -dm -S sessionname sh -c 'cat filename; exec bash' sessionname keeps running, instead, using in through ssh: ssh username@ip screen -dm -S sessionname sh -c 'cat filename; exec bash' Leaves me a blank screen session. – dvdvhs Jun 25 '18 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.