{"id":4796,"date":"2012-10-17T13:15:29","date_gmt":"2012-10-17T17:15:29","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=4796"},"modified":"2012-10-17T13:15:29","modified_gmt":"2012-10-17T17:15:29","slug":"add-a-separator-between-commands-in-linux-terminal","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/","title":{"rendered":"Add a Separator Between Commands in Linux Terminal"},"content":{"rendered":"<p>From <a href=\"http:\/\/lifehacker.com\/5840450\/add-a-handy-separator-between-commands-in-your-terminal-on-mac-os-x-and-linux\" target=\"_blank\" rel=\"noopener noreferrer\">Lifehacker.com<\/a><\/p>\n<p>If working in the Terminal gets a little confusing because you run so many commands at once, this little trick will put a separator in between each prompt so you can easily see the last few commands you ran. Blogger Emilis found that his bash prompt was getting a bit too cluttered, so he implemented this tweak to throw a long, dotted line between each command. He also bolded each command he ran, so he could easily scroll back and tell the difference between each command he ran and its output.<br \/>\n<!--more--><br \/>\nTo use this on Linux, just copy the following code (<a href=\"https:\/\/github.com\/emilis\/emilis-config\/blob\/master\/.bash_ps1\" title=\"github\" target=\"_blank\" rel=\"noopener noreferrer\">available on GitHub as well<\/a>), and put it in a new file called <strong>.bash_ps1<\/strong> in your home folder:<\/p>\n<p><code><br \/>\n# Fill with minuses<br \/>\n # (this is recalculated every time the prompt is shown in function prompt_command):<br \/>\n fill=\"--- \"<br \/>\nreset_style='\\[\\033[00m\\]'<br \/>\n status_style=$reset_style'\\[\\033[0;90m\\]' # gray color; use 0;37m for lighter color<br \/>\n prompt_style=$reset_style<br \/>\n command_style=$reset_style'\\[\\033[1;29m\\]' # bold black<br \/>\n # Prompt variable:<\/p>\n<p>PS1=\"$status_style\"'$fill \\t\\n'\"$prompt_style\"'${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$'\"$command_style \"<\/p>\n<p># Reset color for command output<br \/>\n # (this one is invoked every time before a command is executed):<br \/>\n trap 'echo -ne \"\\e[0m\"' DEBUG<\/p>\n<p>function prompt_command {<\/p>\n<p># create a $fill of all screen width minus the time string and a space:<br \/>\n let fillsize=${COLUMNS}-9<br \/>\n fill=\"\"<br \/>\n while [ \"$fillsize\" -gt \"0\" ]<br \/>\n do<br \/>\n fill=\"-${fill}\" # fill with underscores to work on<br \/>\n let fillsize=${fillsize}-1<br \/>\n done<\/p>\n<p># If this is an xterm set the title to user@host:dir<br \/>\n case \"$TERM\" in<br \/>\n xterm*|rxvt*)<br \/>\n bname=`basename \"${PWD\/$HOME\/~}\"`<br \/>\n echo -ne \"\\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD\/$HOME\/~}\\007\"<br \/>\n ;;<br \/>\n *)<br \/>\n ;;<br \/>\n esac<\/p>\n<p>}<br \/>\n PROMPT_COMMAND=prompt_command<br \/>\n<\/code><br \/>\n &nbsp; &nbsp;<br \/>\nThen, run the following command in a Linux Terminal:<br \/>\n<code>vim ~\/.bashrc<\/code><br \/>\n&nbsp;<br \/>\nPaste the following code into that file, hit Ctrl+X to save, press Y to confirm, and restart the Terminal.<br \/>\n<code><br \/>\nif [ -f \"$HOME\/.bash_ps1\" ]; then<br \/>\n . \"$HOME\/.bash_ps1\"<br \/>\n fi<br \/>\n<\/code><br \/>\n&nbsp; &nbsp;<br \/>\nYou should see your new changes in effect. You should see separators between each command, and those commands will be in bold (while everything else is plain).<br \/>\n&nbsp; &nbsp;<br \/>\nFrom <a href=\"http:\/\/lifehacker.com\/5840450\/add-a-handy-separator-between-commands-in-your-terminal-on-mac-os-x-and-linux\" target=\"_blank\" rel=\"noopener noreferrer\">Lifehacker.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From Lifehacker.com If working in the Terminal gets a little confusing because you run so many commands at once, this little trick will put a separator in between each prompt so you can easily see the last few commands you ran. Blogger Emilis found that his bash prompt was getting a bit too cluttered, so&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-4796","post","type-post","status-publish","format-standard","hentry","category-cli"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Add a Separator Between Commands in Linux Terminal - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add a Separator Between Commands in Linux Terminal - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From Lifehacker.com If working in the Terminal gets a little confusing because you run so many commands at once, this little trick will put a separator in between each prompt so you can easily see the last few commands you ran. Blogger Emilis found that his bash prompt was getting a bit too cluttered, so... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-17T17:15:29+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Add a Separator Between Commands in Linux Terminal\",\"datePublished\":\"2012-10-17T17:15:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/\"},\"wordCount\":197,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"CLI\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/\",\"name\":\"Add a Separator Between Commands in Linux Terminal - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2012-10-17T17:15:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/add-a-separator-between-commands-in-linux-terminal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add a Separator Between Commands in Linux Terminal\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add a Separator Between Commands in Linux Terminal - Linux Shtuff","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:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/","og_locale":"en_US","og_type":"article","og_title":"Add a Separator Between Commands in Linux Terminal - Linux Shtuff","og_description":"From Lifehacker.com If working in the Terminal gets a little confusing because you run so many commands at once, this little trick will put a separator in between each prompt so you can easily see the last few commands you ran. Blogger Emilis found that his bash prompt was getting a bit too cluttered, so... Read More","og_url":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2012-10-17T17:15:29+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Add a Separator Between Commands in Linux Terminal","datePublished":"2012-10-17T17:15:29+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/"},"wordCount":197,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["CLI"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/","url":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/","name":"Add a Separator Between Commands in Linux Terminal - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2012-10-17T17:15:29+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/add-a-separator-between-commands-in-linux-terminal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Add a Separator Between Commands in Linux Terminal"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/4796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=4796"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/4796\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=4796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=4796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=4796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}