Linux: screen command

From Define Wiki
Revision as of 11:45, 5 August 2014 by Jon (talk | contribs) (Created page with "== Initiate a screen session and disconnect immediately == <syntaxhighlight> [root@nodea ~]# screen -S 'jhtest' -d -m [root@nodea ~]# screen -list There is a screen on: 2653.jhtest (Det...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Initiate a screen session and disconnect immediately

[root@nodea ~]# screen -S 'jhtest' -d -m
[root@nodea ~]# screen -list
There is a screen on:
	2653.jhtest	(Detached)

Parse a command to a running screen session

  • Initiate and disconnect from your named screen session
screen -r "jhtest" -X stuff $'cd /benchmark\n'
  • -r = reconnect screen session
  • "jhtest" = name of the screen session
  • -X = send commands to a running screen session
  • stuff = stuff command lets you send keystrokes
  • $ = $ before the command is to make the shell parse the \n inside the quotes and the newline is required to execute the command (like when you press enter)
  • 'cd /tmp\n' = the command to run followed by /n keystroke