{"id":2481,"date":"2012-02-15T14:29:31","date_gmt":"2012-02-15T19:29:31","guid":{"rendered":"http:\/\/www.jerslife.com\/word\/?p=2481"},"modified":"2012-02-17T15:39:57","modified_gmt":"2012-02-17T20:39:57","slug":"linux-shell-prompt-customized","status":"publish","type":"post","link":"http:\/\/www.jerslife.com\/word\/linux-shell-prompt-customized","title":{"rendered":"Linux Shell Prompt Customized"},"content":{"rendered":"<p>Yes, I know it is not the most exciting thing in the world, but the simplest things are often the most meaningful, and for those of us who grew up before windows, or for those n00bs who are brave enough to dare travel the land of the command line, here&#8217;s a tip for you.\u00a0 (That was all in one sentence&#8230; and it felt good)<\/p>\n<p>You can customize your prompt in order to make it more effective.\u00a0 My default prompt was about half a line long and didn&#8217;t really contain much useful information to me, so I changed it, including added a little color. Me? I like to see the time and my current directory, so that&#8217;s what I added using the instructions <a href=\"http:\/\/www.cyberciti.biz\/faq\/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix\/\">here<\/a>, and even <a title=\"Ubuntu Forums\" href=\"http:\/\/ubuntuforums.org\/showthread.php?t=614743\">fancier color management instructions here<\/a>. Simply put, I edited my .bashrc file&#8217;s prompt entry to the following. If you haven&#8217;t done this kind of edit before, first make a backup copy file.<\/p>\n<blockquote><p><strong><code>PS1=\"\\e[0;35m[\\t]\\e[m\\w$ \"<\/code><\/strong><\/p><\/blockquote>\n<p><em>*UPDATE*<\/em><\/p>\n<p>Ok, the above line looks pretty, but the text wrapping gets funked up. You have to put escaped opening and closing square brackets around the color code chunks.\u00a0 The following revised line works great.<\/p>\n<blockquote><p><strong><code>PS1=\"<span style=\"color: #993300;\">\\[<\/span>\\e[0;35m<span style=\"color: #993300;\">\\]<\/span>[\\t]<span style=\"color: #993300;\">\\[<\/span>\\e[m<span style=\"color: #993300;\">\\]<\/span>\\w$ \"<\/code><\/strong><\/p><\/blockquote>\n<p>And here&#8217;s the before and after.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.jerslife.com\/word\/wp-content\/uploads\/2012\/02\/newPrompt.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2482 aligncenter\" title=\"newPrompt\" src=\"http:\/\/www.jerslife.com\/word\/wp-content\/uploads\/2012\/02\/newPrompt.gif\" alt=\"\" width=\"570\" height=\"324\" srcset=\"http:\/\/www.jerslife.com\/word\/wp-content\/uploads\/2012\/02\/newPrompt.gif 814w, http:\/\/www.jerslife.com\/word\/wp-content\/uploads\/2012\/02\/newPrompt-300x170.gif 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><\/p>\n<p>Ahhh&#8230;\u00a0\u00a0 almost zen.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, I know it is not the most exciting thing in the world, but the simplest things are often the most meaningful, and for those of us who grew up before windows, or for those n00bs who are brave enough to dare travel the land of the command line, here&#8217;s a tip for you.\u00a0 (That [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[781,81,443,512,390],"class_list":["post-2481","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-how-to","tag-linux","tag-shell","tag-terminal","tag-ubuntu"],"_links":{"self":[{"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/posts\/2481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/comments?post=2481"}],"version-history":[{"count":3,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/posts\/2481\/revisions"}],"predecessor-version":[{"id":2497,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/posts\/2481\/revisions\/2497"}],"wp:attachment":[{"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/media?parent=2481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/categories?post=2481"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jerslife.com\/word\/wp-json\/wp\/v2\/tags?post=2481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}