{"id":12915,"date":"2021-11-25T15:40:41","date_gmt":"2021-11-25T20:40:41","guid":{"rendered":"https:\/\/carleton.ca\/scs\/?page_id=12915"},"modified":"2021-11-25T15:57:59","modified_gmt":"2021-11-25T20:57:59","slug":"linux-background-processes","status":"publish","type":"page","link":"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/","title":{"rendered":"Linux background processes"},"content":{"rendered":"<p>A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your Window Manager and the process will keep running with no user interaction.<\/p>\n<h3>Use Case<\/h3>\n<p>You may want to run a program in the background because that program may take hours maybe days to complete. If you rely on the shell or window manager then that can become problematic! If your job is expected to take many days to complete you don&#8217;t want to have an active shell for that time period, that is if the shell is closed your program may be terminated as well!<\/p>\n<p>This article will explain how you can run Linux jobs in the background.<\/p>\n<p>Managing processees<\/p>\n<h3>Processees<\/h3>\n<p>Everything that you run in Linux is a process! You can manage processes using a number of shell commands.<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 184px;\">\n<tbody>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\"><strong>Command<\/strong><\/td>\n<td style=\"width: 82.159%; height: 23px;\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">ps -ef<\/td>\n<td style=\"width: 82.159%; height: 23px;\">Display all the running processees<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">top<\/td>\n<td style=\"width: 82.159%; height: 23px;\">Real-time process listing sorted by CPU utilization<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">killall<\/td>\n<td style=\"width: 82.159%; height: 23px;\">Terminate a process by name<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">kill -9<\/td>\n<td style=\"width: 82.159%; height: 23px;\">Terminate a process<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">screen<\/td>\n<td style=\"width: 82.159%; height: 23px;\">A program that allows you to run multiple virtual terminals<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\">tmux<\/td>\n<td style=\"width: 82.159%; height: 23px;\">Another program that allows you to run multiple virtual terminals<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 17.841%; height: 23px;\"><\/td>\n<td style=\"width: 82.159%; height: 23px;\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p>You can check what processes are running by starting a terminal shell and running the top command:<\/p>\n<p><a href=\"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-12917\" src=\"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55.png\" alt=\"Linux top command\" width=\"754\" height=\"506\" srcset=\"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55.png 754w, https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55-240x161.png 240w, https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55-400x268.png 400w, https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55-160x107.png 160w, https:\/\/carleton.ca\/scs\/wp-content\/uploads\/Screenshot-from-2021-11-25-15-37-55-360x242.png 360w\" sizes=\"(max-width: 754px) 100vw, 754px\" \/><\/a><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p>This will sort the most CPU intensive applications at the &#8216;top&#8217; of the listing. If you care to see all the processes then you can run the ps command.<\/p>\n<p><\/p>\n<p>ps -ef<\/p>\n<p><\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your Window Manager and the process will keep running with no user interaction. Use Case You may want to run a program in the background because that program [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"parent":6535,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_mi_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux background processes - School of Computer Science<\/title>\n<meta name=\"description\" content=\"A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/\",\"url\":\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/\",\"name\":\"Linux background processes - School of Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/carleton.ca\/scs\/#website\"},\"datePublished\":\"2021-11-25T20:40:41+00:00\",\"dateModified\":\"2021-11-25T20:57:59+00:00\",\"description\":\"A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your\",\"breadcrumb\":{\"@id\":\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/carleton.ca\/scs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Technical Support\",\"item\":\"https:\/\/carleton.ca\/scs\/tech-support\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux background processes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/carleton.ca\/scs\/#website\",\"url\":\"https:\/\/carleton.ca\/scs\/\",\"name\":\"School of Computer Science\",\"description\":\"Carleton University\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/carleton.ca\/scs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux background processes - School of Computer Science","description":"A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your","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:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/","url":"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/","name":"Linux background processes - School of Computer Science","isPartOf":{"@id":"https:\/\/carleton.ca\/scs\/#website"},"datePublished":"2021-11-25T20:40:41+00:00","dateModified":"2021-11-25T20:57:59+00:00","description":"A Linux background process is defined as being a process that is running independent of the shell or Window Manager. You can leave the shell or exit your","breadcrumb":{"@id":"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/carleton.ca\/scs\/tech-support\/linux-background-processes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/carleton.ca\/scs\/"},{"@type":"ListItem","position":2,"name":"Technical Support","item":"https:\/\/carleton.ca\/scs\/tech-support\/"},{"@type":"ListItem","position":3,"name":"Linux background processes"}]},{"@type":"WebSite","@id":"https:\/\/carleton.ca\/scs\/#website","url":"https:\/\/carleton.ca\/scs\/","name":"School of Computer Science","description":"Carleton University","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/carleton.ca\/scs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"}]}},"acf":{"banner_image_type":"upload","banner_button":"no","banner_uploaded_image":{"ID":8983,"id":8983,"title":"Coding screen","filename":"laptop-code-1600.jpg","filesize":154356,"url":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600.jpg","link":"https:\/\/carleton.ca\/scs\/tech-support\/laptop-code-1600\/","alt":"Coding screen","author":"7","description":"Coding screen","caption":"","name":"laptop-code-1600","status":"inherit","uploaded_to":6535,"date":"2021-02-10 15:47:55","modified":"2021-11-25 20:57:39","menu_order":0,"mime_type":"image\/jpeg","type":"image","subtype":"jpeg","icon":"https:\/\/carleton.ca\/scs\/wp\/wp-includes\/images\/media\/default.png","width":1600,"height":700,"sizes":{"thumbnail":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-160x70.jpg","thumbnail-width":160,"thumbnail-height":70,"medium":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-240x105.jpg","medium-width":240,"medium-height":105,"medium_large":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-768x336.jpg","medium_large-width":768,"medium_large-height":336,"large":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-400x175.jpg","large-width":400,"large-height":175,"gallery-thumb":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-300x230.jpg","gallery-thumb-width":300,"gallery-thumb-height":230,"1536x1536":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-1536x672.jpg","1536x1536-width":1536,"1536x1536-height":672,"2048x2048":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600.jpg","2048x2048-width":1600,"2048x2048-height":700,"banner":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600.jpg","banner-width":1600,"banner-height":700,"people":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-200x200.jpg","people-width":200,"people-height":200,"post-thumb":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-300x230.jpg","post-thumb-width":300,"post-thumb-height":230,"rotator-image":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-800x600.jpg","rotator-image-width":800,"rotator-image-height":600,"video-thumb":"https:\/\/carleton.ca\/scs\/wp-content\/uploads\/laptop-code-1600-360x158.jpg","video-thumb-width":360,"video-thumb-height":158}},"banner_opacity":"dark"},"_links":{"self":[{"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/pages\/12915"}],"collection":[{"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/comments?post=12915"}],"version-history":[{"count":3,"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/pages\/12915\/revisions"}],"predecessor-version":[{"id":12920,"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/pages\/12915\/revisions\/12920"}],"up":[{"embeddable":true,"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/pages\/6535"}],"wp:attachment":[{"href":"https:\/\/carleton.ca\/scs\/wp-json\/wp\/v2\/media?parent=12915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}