{"id":437,"date":"2018-01-25T13:32:42","date_gmt":"2018-01-25T13:32:42","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=437"},"modified":"2018-01-25T13:32:42","modified_gmt":"2018-01-25T13:32:42","slug":"how-to-start-a-screen-session-and-run-a-command-at-a-time","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/how-to-start-a-screen-session-and-run-a-command-at-a-time.html","title":{"rendered":"How To: Start a Screen Session and Run a Command at a Time"},"content":{"rendered":"<p>Sometimes, you may want to run a screen command in a remote server. That makes it necessary to run the command inside the screen session while starting it.<\/p>\n<h4>How to start a screen session and run a command in one line<\/h4>\n<p><code># screen -d -m sh -c \"yourcommand\"<\/code><\/p>\n<p>From the man page of Screen:<\/p>\n<p>-d -m : Start screen in &#8220;detached&#8221; mode. This creates a new session but doesn&#8217;t attach to it. This is useful for system startup scripts.<\/p>\n<p>sh -c: Starts a shell and runs a command for you.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you may want to run a screen command in a remote server. That makes it necessary to run the command inside the screen session while starting it. How to start a screen session and run a command in one line # screen -d -m sh -c &#8220;yourcommand&#8221; From the man page of Screen: -d &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/how-to-start-a-screen-session-and-run-a-command-at-a-time.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To: Start a Screen Session and Run a Command at a Time&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[193,180,12,191,21,150,25,192],"tags":[199,70,218,268,269,270,198],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/437"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=437"}],"version-history":[{"count":1,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/437\/revisions"}],"predecessor-version":[{"id":438,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/437\/revisions\/438"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}