{"id":218,"date":"2016-01-12T15:32:16","date_gmt":"2016-01-12T20:32:16","guid":{"rendered":"http:\/\/wp-p3d2tsa2xh.pairsite.com\/?p=218"},"modified":"2019-02-14T09:15:12","modified_gmt":"2019-02-14T14:15:12","slug":"paircloud-tutorial-using-the-shell-part-2","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/","title":{"rendered":"Tutorial: Using the Shell, Part 2"},"content":{"rendered":"<h3 class=\"kb\">Introduction<\/h3>\n<p>In this tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.<\/p>\n<h3 class=\"kb\">Start a program in the background<\/h3>\n<p>If you are going to be starting a long-running program and you want it to run in the background, you just need to add an <span style=\"font-family: monospace; background-color: #e4e4e4;\">&amp;<\/span> to the end of the command. For example, if you wanted to generate a list of all directory usage on your system, you would execute <span style=\"font-family: monospace; background-color: #e4e4e4;\">cd \/<\/span> then run <span style=\"font-family: monospace; background-color: #e4e4e4;\">du -h &gt;list.txt<\/span>. This could take quite a while to run on a large system. To run this in the background, use <span style=\"font-family: monospace; background-color: #e4e4e4;\">du -h &gt;list.txt &amp;<\/span><\/p>\n<p>This will return you straight to the prompt after displaying some lines like this:<\/p>\n<pre>[root@plesk \/]# du -h &gt;list.txt &amp;\r\n[1] 1821<\/pre>\n<p>The number in the square brackets, in this case <span style=\"font-family: monospace; background-color: #e4e4e4;\">[1]<\/span>, is the job number.<\/p>\n<h3 class=\"kb\">Pausing a Job<\/h3>\n<p>If you have started a task and want to pause it, use the <span style=\"font-family: monospace; background-color: #e4e4e4;\">CTRL<\/span> + <span style=\"font-family: monospace; background-color: #e4e4e4;\">z<\/span> keys. This will suspend the job and put it to sleep. Use the <span style=\"font-family: monospace; background-color: #e4e4e4;\">jobs<\/span> command to list all jobs. This will give you something like this:<\/p>\n<pre>[root@plesk \/]# du -h &gt;list.txt\r\n^Z\r\n[1]+  Stopped                 du -h &gt; list.txt<\/pre>\n<p>As you can see, it is listed as <span style=\"font-family: monospace; background-color: #e4e4e4;\">stopped<\/span>. To start it running again, use either the foreground or background commands <span style=\"font-family: monospace; background-color: #e4e4e4;\">fg<\/span> or <span style=\"font-family: monospace; background-color: #e4e4e4;\">bg<\/span>. For example, <span style=\"font-family: monospace; background-color: #e4e4e4;\">bg 1<\/span>. If you don\u2019t know the job number, issue the <span style=\"font-family: monospace; background-color: #e4e4e4;\">jobs<\/span> command to list current jobs.<\/p>\n<h3 class=\"kb\">Sending a program to the background<\/h3>\n<p>To send a running foreground program to the background, you will need to pause it first using <span style=\"font-family: monospace; background-color: #e4e4e4;\">CTRL<\/span> + <span style=\"font-family: monospace; background-color: #e4e4e4;\">z<\/span> then issue the <span style=\"font-family: monospace; background-color: #e4e4e4;\">bg [jobnumber]<\/span> command.<\/p>\n<h3 class=\"kb\">Bring a background job back to the foreground<\/h3>\n<p>Use the <span style=\"font-family: monospace; background-color: #e4e4e4;\">jobs<\/span> command to find out what the job number is and use the <span style=\"font-family: monospace; background-color: #e4e4e4;\">fg [jobnumber]<\/span> command to bring it back to running in the foreground.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep. Start a program in the background If you are going to be starting a long-running program and you want it to run&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[203],"ht-kb-tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks<\/title>\n<meta name=\"description\" content=\"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks\" \/>\n<meta property=\"og:description\" content=\"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-14T14:15:12+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/\",\"name\":\"Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2016-01-12T20:32:16+00:00\",\"dateModified\":\"2019-02-14T14:15:12+00:00\",\"description\":\"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorial: Using the Shell, Part 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks","description":"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/","og_locale":"en_US","og_type":"article","og_title":"Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks","og_description":"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.","og_url":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2019-02-14T14:15:12+00:00","twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/","url":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/","name":"Tutorial: Using the Shell, Part 2 - Knowledge Base - Pair Networks","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2016-01-12T20:32:16+00:00","dateModified":"2019-02-14T14:15:12+00:00","description":"In this shell tutorial, we will cover how to send programs into the background, how to restore them to the foreground, and how to send programs to sleep.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-tutorial-using-the-shell-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"Tutorial: Using the Shell, Part 2"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/218"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":7,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/218\/revisions"}],"predecessor-version":[{"id":6630,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/218\/revisions\/6630"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=218"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=218"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}