{"id":1433,"date":"2015-05-01T09:55:25","date_gmt":"2015-05-01T09:55:25","guid":{"rendered":"https:\/\/intelligentbee.com\/blog\/?p=1433"},"modified":"2024-08-28T12:22:54","modified_gmt":"2024-08-28T12:22:54","slug":"how-to-show-the-full-path-in-the-os-x-terminal","status":"publish","type":"post","link":"https:\/\/intelligentbee.com\/blog\/how-to-show-the-full-path-in-the-os-x-terminal\/","title":{"rendered":"How to Show the Full Path in the OS X Terminal"},"content":{"rendered":"<p>Working and constantly switching between multiple projects in the OS X Terminal or iTerm (whatever you prefer) can be hassle since, by default, you cannot see the full path of the directory you&#8217;re working in. Here&#8217;s how to change that.<\/p>\n<h2>How to show the full path in the os x terminal<\/h2>\n<p>But first, in the spirit of full disclosure, I&#8217;d like to mention that I only found out how to display the full path after I\u00a0accidentally\u00a0destroyed the virtual machine of the wrong project and I had to install the whole damn thing all over again.<\/p>\n<p>&nbsp;<\/p>\n<p>As you might have noticed, the Terminal only displays the current folder in which you&#8217;re working so it can be pretty easy to make a mistake when your projects have a similar folder structure or are built with the same framework.<\/p>\n<p>&nbsp;<\/p>\n<p>This first thing you need to do to address that is to fire up your Terminal and open your\u00a0<code>.bash_profile<\/code> file:<\/p>\n<pre class=\"lang:default decode:true \">sudo nano ~\/.bash_profile<\/pre>\n<p>Then head over to a new line and add:<\/p>\n<pre class=\"lang:default decode:true \">PS1=\"\\w$ \"<\/pre>\n<p>Save and close the file, then restart your Terminal. You should now notice that when you browse through your directories, the path should look something like this:<\/p>\n<pre class=\"lang:default decode:true \">~\/Development\/hpm\/vagrant$<\/pre>\n<p>The <code>\\w<\/code> symbol you noticed stands for &#8220;Current working directory, full path (ie: \/Users\/Admin\/Desktop)&#8221; while the <code>$<\/code> mark followed by a space is simply a separator between the working path and the input area.<\/p>\n<h3>How to show the full path in the os x terminal<\/h3>\n<p>If you want to make the Terminal look even more awesome, here are some other options you can\u00a0add to PS1:<\/p>\n<pre class=\"lang:sh decode:true \">\\W \u2013 Current working directory (ie: Desktop\/)\r\n\r\n\\d \u2013 Current date\r\n\r\n\\t \u2013 Current time\r\n\r\n\\h \u2013 Host name\r\n\r\n\\# \u2013 Command number\r\n\r\n\\u \u2013 User name<\/pre>\n<p>So for, example, using <code>PS1=\"\\u@\\w$ \"<\/code> will output <code>\"Sebi@~\/Development$ \"<\/code>.<\/p>\n<p>I really hope this small tutorial helped. Have fun!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working and constantly switching between multiple projects in the OS X Terminal or iTerm (whatever you prefer) can be hassle [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":1438,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[187,243],"yst_prominent_words":[319,411,700,1013,1058,1437,2330],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1433"}],"collection":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/comments?post=1433"}],"version-history":[{"count":3,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1433\/revisions"}],"predecessor-version":[{"id":133203,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1433\/revisions\/133203"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/media\/1438"}],"wp:attachment":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/media?parent=1433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/categories?post=1433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/tags?post=1433"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=1433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}