I'm running a minecraft server inside a screen session. I want to send a command to that screen session and get the command result back (and print it back). Can I do that without using the screen -L option?

Demonstration inside of a bash script (obviously wrong!):

result=$(screen -S "minecraft-server" -p 0 -X stuff "list"`echo -ne '\015'`)
printf "$result\n"

1 Answer 1


One way is to use the logs. Everything printed to screen is also printed to log:

My minecraft server is located at /home/minecraft, and runs as the 'minecraft' user (not me).

  1. Send message:

    screen -p 0 -S minecraft-server -X eval 'stuff "say TEST MESSAGE..."\\015'

  2. Read the output several ways:

    • tail /home/minecraft/logs/latest.log

    • less /home/minecraft/logs/latest.log plus CTRL+G to advance to the end

    • less /home/minecraft/logs/latest.log plus CTRL+F to keep monitoring new output as it arrives.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .