Search code examples
bashshellgnu-screen

How to create a bash screen with multiple commands


I´m new on the linux screen command but I know that you can create a new detached named screen executing a command screen -dmS SCREEN_NAME command But is there a way to create a new detached screen executing two commands? like screen -dmS SCREEN_NAME cd PATH java -jar *.jar


Solution

  • You can do it like this:

    screen -dmS SCREEN_NAME bash -c 'command1...; command2 ...'