0

When I type in:

screen -S game;ls;

However the 'ls' command is executed outside the screen.

How can I start the 'game' screen and execute the ls command inside the screen ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
yarek
  • 11,278
  • 30
  • 120
  • 219

1 Answers1

1
screen [ -options ] [ cmd [ args ] ]

example: screen -S game ls

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
vscoder
  • 26
  • 2
  • problem is : that solution start screen, execute ls and close the screen. Any idea on how not to close the screen, but ONLY detach it ? – yarek Aug 04 '15 at 12:20
  • -d -m Start screen in "detached" mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts. – vscoder Aug 04 '15 at 12:36
  • example: `screen -S test -d -m cat /dev/urandom` – vscoder Aug 04 '15 at 12:37
  • screen session will exists until `cat /dev/urandom` not terminated – vscoder Aug 04 '15 at 12:38