title
Customizing Your Terminal: Adding Color and Information to Your Prompt

description
In this video, we will be learning how to customize our terminal with dotfiles. In a previous video we learned about the difference between the .bash_profile and .bashrc files. And in this video we will be customizing those files in order to add color and information to our command prompt. In our next video we will be putting all of this together and exploring the real power of dotfiles, but before we get ahead of ourselves, let's customize our prompt... Previous Video on .bash_profile and .bashrc: https://youtu.be/vDOVEDl2z84 Next Video on Dotfiles: https://youtu.be/c5RZWDLqifA 256 Color Chart: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg ✅ Support My Channel Through Patreon: https://www.patreon.com/coreyms ✅ Become a Channel Member: https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join ✅ One-Time Contribution Through PayPal: https://goo.gl/649HFY ✅ Cryptocurrency Donations: Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3 Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33 Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot ✅ Corey's Public Amazon Wishlist http://a.co/inIyro1 ✅ Equipment I Use and Books I Recommend: https://www.amazon.com/shop/coreyschafer ▶️ You Can Find Me On: My Website - http://coreyms.com/ My Second Channel - https://www.youtube.com/c/coreymschafer Facebook - https://www.facebook.com/CoreyMSchafer Twitter - https://twitter.com/CoreyMSchafer Instagram - https://www.instagram.com/coreymschafer/

detail
{'title': 'Customizing Your Terminal: Adding Color and Information to Your Prompt', 'heatmap': [{'end': 833.933, 'start': 758.565, 'weight': 0.723}, {'end': 1004.988, 'start': 980.05, 'weight': 0.785}], 'summary': 'Learn how to customize the terminal prompt by modifying the bash rc file and editing the ps1 variable, add dynamic information and color to the bash prompt, and source the bash rc file for cursor handling and advanced customizations, with hints at future videos on dot files and github dot file exploration.', 'chapters': [{'end': 66.011, 'segs': [{'end': 52.183, 'src': 'embed', 'start': 20.908, 'weight': 0, 'content': [{'end': 22.489, 'text': "But with that said, let's go ahead and get started.", 'start': 20.908, 'duration': 1.581}, {'end': 28.111, 'text': 'So right now I currently have my terminal open, which is an un-customized terminal just from scratch.', 'start': 22.909, 'duration': 5.202}, {'end': 32.673, 'text': 'And I also have my bash RC file opened up in Sublime Text here.', 'start': 28.651, 'duration': 4.022}, {'end': 37.795, 'text': "Now, in order to customize my prompt, I'm going to edit the PS1 variable.", 'start': 33.153, 'duration': 4.642}, {'end': 41.317, 'text': 'And we saw this a little bit in the last video.', 'start': 38.255, 'duration': 3.062}, {'end': 45.179, 'text': "So first let's just do something extremely simple here.", 'start': 42.197, 'duration': 2.982}, {'end': 52.183, 'text': "So I'm going to do ps1 equals and I'm just going to do an arrow and then cut that off and save it.", 'start': 45.199, 'duration': 6.984}], 'summary': 'Customizing ps1 variable in terminal for prompt display.', 'duration': 31.275, 'max_score': 20.908, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU20908.jpg'}], 'start': 0.229, 'title': 'Customizing terminal prompt', 'summary': 'Discusses how to customize the terminal prompt by modifying the bash rc file and editing the ps1 variable, demonstrated through a simple example.', 'chapters': [{'end': 66.011, 'start': 0.229, 'title': 'Customizing terminal prompt', 'summary': 'Discusses customizing the terminal prompt by modifying the bash rc file and editing the ps1 variable to change the colors and appearance, demonstrated through a simple example.', 'duration': 65.782, 'highlights': ['The process involves modifying the bash rc file and editing the PS1 variable to customize the terminal prompt. Modifying bash rc file, Editing PS1 variable', 'Demonstrates a simple example of customizing the prompt by adding an arrow and creating space after it. Adding arrow to PS1, Creating space for text']}], 'duration': 65.782, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU229.jpg', 'highlights': ['Demonstrates a simple example of customizing the prompt by adding an arrow and creating space after it.', 'The process involves modifying the bash rc file and editing the PS1 variable to customize the terminal prompt.']}, {'end': 750.143, 'segs': [{'end': 160.525, 'src': 'embed', 'start': 137.83, 'weight': 0, 'content': [{'end': 146.976, 'text': 'And now if I save that and source the BashRC file again, Now you can see here that my username is before the arrow.', 'start': 137.83, 'duration': 9.146}, {'end': 150.879, 'text': "So now we have some dynamic information that we're using as our prompt.", 'start': 147.397, 'duration': 3.482}, {'end': 159.225, 'text': "So the backslash U represents the username of the current user, but there's also some other special characters that we can use here as well,", 'start': 151.359, 'duration': 7.866}, {'end': 160.525, 'text': 'and I have a couple of them written down.', 'start': 159.225, 'duration': 1.3}], 'summary': 'Customized bash prompt displays dynamic user information.', 'duration': 22.695, 'max_score': 137.83, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU137830.jpg'}, {'end': 327.664, 'src': 'embed', 'start': 299.194, 'weight': 2, 'content': [{'end': 303.136, 'text': "but right now we're going to only use a command called tput.", 'start': 299.194, 'duration': 3.942}, {'end': 310.403, 'text': "Now I'm not going to go too much into the syntax that bash uses here, We could do a whole series on videos on bash scripting.", 'start': 303.556, 'duration': 6.847}, {'end': 315.951, 'text': "But for this walkthrough, I'm just going to show you what we need to do in order to get our colors working within the prompt.", 'start': 311.063, 'duration': 4.888}, {'end': 323.182, 'text': 'So in bash, we can do something called command substitution with a dollar sign and parentheses here.', 'start': 316.452, 'duration': 6.73}, {'end': 327.664, 'text': 'And if we put a command inside of these parentheses,', 'start': 323.682, 'duration': 3.982}], 'summary': 'Using tput command for color in bash scripting.', 'duration': 28.47, 'max_score': 299.194, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU299194.jpg'}, {'end': 398.441, 'src': 'embed', 'start': 366.224, 'weight': 1, 'content': [{'end': 368.185, 'text': "So that's what this command substitution does.", 'start': 366.224, 'duration': 1.961}, {'end': 373.807, 'text': 'It takes a command and it replaces all of this with the result of that command.', 'start': 368.265, 'duration': 5.542}, {'end': 378.549, 'text': 'So what the tput command does is it can change the foreground text color.', 'start': 374.287, 'duration': 4.262}, {'end': 386.972, 'text': 'So we can use that same technique and if we put that command before some text then it will apply color to that text.', 'start': 379.269, 'duration': 7.703}, {'end': 398.441, 'text': 'So, for example, if I was to do echo and then I was to do our command substitution here and I was to do tput and then set AF,', 'start': 387.432, 'duration': 11.009}], 'summary': 'Command substitution replaces text with result of command, tput changes text color.', 'duration': 32.217, 'max_score': 366.224, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU366224.jpg'}, {'end': 446.541, 'src': 'embed', 'start': 415.196, 'weight': 3, 'content': [{'end': 417.621, 'text': 'this is orange and apply orange text to it.', 'start': 415.196, 'duration': 2.425}, {'end': 428.413, 'text': "Now if you're wondering where I got the number 166 for that color of orange, you can do a Google search for a 256 color chart and get results.", 'start': 418.109, 'duration': 10.304}, {'end': 438.418, 'text': 'So, for example, if I pull up the Chrome page that I have open up here, so I did a Google search for a 256 color chart,', 'start': 428.613, 'duration': 9.805}, {'end': 440.899, 'text': 'and this is the Wikipedia page for that.', 'start': 438.418, 'duration': 2.481}, {'end': 446.541, 'text': 'Now if we go down here to 166, then you can see that it matches that orange that I just printed out.', 'start': 441.299, 'duration': 5.242}], 'summary': 'Using a 256 color chart, the color 166 matches the orange printed out.', 'duration': 31.345, 'max_score': 415.196, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU415196.jpg'}], 'start': 66.431, 'title': 'Customizing bash prompt and terminal text colors', 'summary': 'Demonstrates customizing the bash prompt by adding dynamic information such as username, host name, and working directory, and using command substitution for adding color. it also covers using the tput command to change text colors in the terminal, including 256 color chart references.', 'chapters': [{'end': 365.744, 'start': 66.431, 'title': 'Customizing bash prompt with dynamic information', 'summary': 'Demonstrates how to customize the bash prompt by adding dynamic information and using special escaped characters, including the representation of username, host name, shell name, current time, and working directory. additionally, it explores the use of command substitution for adding color to the prompt.', 'duration': 299.313, 'highlights': ['The chapter explains how to customize the Bash prompt by adding dynamic information such as username, host name, and working directory using special escaped characters like \\U, \\H, and \\w. ', 'It also demonstrates the use of command substitution with the dollar sign and parentheses to incorporate color into the prompt using the tput command. ', 'The chapter highlights the usage of special escaped characters like \\N for new line and \\T for the current time in customizing the Bash prompt. ']}, {'end': 750.143, 'start': 366.224, 'title': 'Customizing terminal text colors', 'summary': 'Demonstrates using the tput command for changing text colors in the terminal, with examples of applying colors to text and the terminal prompt, including the use of 256 color chart references.', 'duration': 383.919, 'highlights': ['Demonstrating tput command for changing text colors The chapter provides examples of using the tput command to change the foreground text color and applying color to text and the terminal prompt.', 'Applying colors to text and terminal prompt The transcript illustrates applying colors to text and the terminal prompt by using the tput command and demonstrates the output with examples such as applying orange text and customizing the prompt with different colors.', 'Use of 256 color chart for color references The speaker refers to using a 256 color chart for color references, mentioning the process of obtaining the color value of 166 for orange and providing an example of referencing the Wikipedia page for color matching.']}], 'duration': 683.712, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU66431.jpg', 'highlights': ['The chapter explains customizing the Bash prompt with dynamic information like username, host name, and working directory using special escaped characters.', 'Demonstrates using command substitution with the tput command to incorporate color into the prompt.', 'Illustrates applying colors to text and the terminal prompt using the tput command.', 'Refers to using a 256 color chart for color references and obtaining the color value of 166 for orange.']}, {'end': 1107.454, 'segs': [{'end': 833.933, 'src': 'heatmap', 'start': 758.565, 'weight': 0.723, 'content': [{'end': 762.447, 'text': "and also i'm going to cd back to our home directory.", 'start': 758.565, 'duration': 3.882}, {'end': 766.748, 'text': "so now i'm going to try to source that bash rc file.", 'start': 762.447, 'duration': 4.301}, {'end': 775.194, 'text': 'Okay, so you see that we kind of ran into an issue here where the cursor position is acting up.', 'start': 767.952, 'duration': 7.242}, {'end': 787.137, 'text': 'Now. the reason for that is that we need to wrap our commands with these special escape characters so that Bash knows how to properly handle the cursor.', 'start': 775.994, 'duration': 11.143}, {'end': 789.577, 'text': 'And these look like this right here.', 'start': 787.277, 'duration': 2.3}, {'end': 793.578, 'text': 'So we have a backslash and then a bracket.', 'start': 789.717, 'duration': 3.861}, {'end': 797.659, 'text': "And then after our command, we're going to have a backslash and an end bracket.", 'start': 793.698, 'duration': 3.961}, {'end': 803.761, 'text': "So I'm going to copy this here and before every TPUT command, I'm going to paste that in.", 'start': 797.999, 'duration': 5.762}, {'end': 807.602, 'text': "And then I'm going to go ahead and grab this ending one here and copy that.", 'start': 804.101, 'duration': 3.501}, {'end': 812.304, 'text': "And then after every TPUT command, I'm going to paste that in.", 'start': 808.022, 'duration': 4.282}, {'end': 815.345, 'text': "Then I'm going to go ahead and delete this here and save it.", 'start': 812.684, 'duration': 2.661}, {'end': 820.926, 'text': 'Now I know right now this might seem like a lot to remember, but just stick with me.', 'start': 815.845, 'duration': 5.081}, {'end': 825.348, 'text': "We're going to be learning about a few things that makes all this stuff a lot easier to work with.", 'start': 820.966, 'duration': 4.382}, {'end': 833.933, 'text': 'Okay, so now if I open back up my terminal and I run that source command with the, that was kind of the weird cursor position there.', 'start': 825.788, 'duration': 8.145}], 'summary': 'In the transcript, special escape characters are used to fix cursor position in bash commands.', 'duration': 75.368, 'max_score': 758.565, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU758565.jpg'}, {'end': 797.659, 'src': 'embed', 'start': 775.994, 'weight': 0, 'content': [{'end': 787.137, 'text': 'Now. the reason for that is that we need to wrap our commands with these special escape characters so that Bash knows how to properly handle the cursor.', 'start': 775.994, 'duration': 11.143}, {'end': 789.577, 'text': 'And these look like this right here.', 'start': 787.277, 'duration': 2.3}, {'end': 793.578, 'text': 'So we have a backslash and then a bracket.', 'start': 789.717, 'duration': 3.861}, {'end': 797.659, 'text': "And then after our command, we're going to have a backslash and an end bracket.", 'start': 793.698, 'duration': 3.961}], 'summary': 'Wrap commands with escape characters for proper bash handling.', 'duration': 21.665, 'max_score': 775.994, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU775994.jpg'}, {'end': 931.555, 'src': 'embed', 'start': 906.098, 'weight': 2, 'content': [{'end': 911.702, 'text': 'So for example here, I can do orange equal to that TPUT command, yellow equal to this one.', 'start': 906.098, 'duration': 5.604}, {'end': 915.985, 'text': "Now this is one that we haven't seen yet, this bold here, we can do a TPUT bold.", 'start': 912.142, 'duration': 3.843}, {'end': 918.306, 'text': 'And then also we have our reset command.', 'start': 916.285, 'duration': 2.021}, {'end': 926.051, 'text': 'And then, when we want to use one of these values, what we can do is when we do our PS1 equal to,', 'start': 918.726, 'duration': 7.325}, {'end': 931.555, 'text': "and then there's those escape characters that we were talking about the backslash bracket, and then we have the closing bracket here.", 'start': 926.051, 'duration': 5.504}], 'summary': 'Using tput command for text formatting in terminal.', 'duration': 25.457, 'max_score': 906.098, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU906098.jpg'}, {'end': 1026.659, 'src': 'heatmap', 'start': 980.05, 'weight': 1, 'content': [{'end': 983.113, 'text': 'and then I do a reset on all of the formatting.', 'start': 980.05, 'duration': 3.063}, {'end': 988.777, 'text': 'So I know that looks like a lot, but let me save that and then go back to the terminal here.', 'start': 983.493, 'duration': 5.284}, {'end': 995.823, 'text': "And now if I source that file again, then this probably looks a little familiar if you've seen any of my other videos.", 'start': 989.258, 'duration': 6.565}, {'end': 998.545, 'text': 'This is how I have my prompt set up.', 'start': 996.423, 'duration': 2.122}, {'end': 1004.988, 'text': 'So if all that you want to do is customize your prompt with the wording and the colors,', 'start': 999.005, 'duration': 5.983}, {'end': 1012.792, 'text': 'then you can go ahead and play around with commands like this and setting the PS1 and exporting the PS1 variable.', 'start': 1004.988, 'duration': 7.804}, {'end': 1017.174, 'text': "But there's really a whole lot more that you can do with your customizations.", 'start': 1013.552, 'duration': 3.622}, {'end': 1020.736, 'text': "So that's going to go ahead and do it for this video.", 'start': 1018.075, 'duration': 2.661}, {'end': 1026.659, 'text': 'But I want to do some future videos on something called dot files.', 'start': 1021.776, 'duration': 4.883}], 'summary': 'Customize terminal prompt with ps1 and explore dot files.', 'duration': 46.609, 'max_score': 980.05, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU980050.jpg'}, {'end': 1079.774, 'src': 'embed', 'start': 1045.957, 'weight': 3, 'content': [{'end': 1051.741, 'text': "what we've done to the dot bash rc file over here, Now that we've seen some of the things that we can do within these files,", 'start': 1045.957, 'duration': 5.784}, {'end': 1062.745, 'text': "in the next video we'll download some of the dot files that other people have put up on GitHub and look at some of the functionality that other people have managed to squeeze into their dot files.", 'start': 1051.741, 'duration': 11.004}, {'end': 1065.126, 'text': "And it can be extremely powerful the way that they've done this.", 'start': 1062.785, 'duration': 2.341}, {'end': 1079.774, 'text': "So be sure to check out that video and we'll take a look at some of those dot files that are popular online and we'll see how we can set up a get prompt and get auto completion and color codes for fallback values.", 'start': 1065.606, 'duration': 14.168}], 'summary': 'Exploring dot files on github for enhanced functionality and customization.', 'duration': 33.817, 'max_score': 1045.957, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU1045957.jpg'}], 'start': 750.143, 'title': 'Customizing bash prompt and resource bash rc file', 'summary': 'Covers sourcing the bash rc file for cursor handling and customizing the bash prompt using the ps1 variable. it includes the use of special escape characters, tput commands, color variables, and dot files for advanced customizations. additionally, future videos on dot files and github dot file exploration are hinted at.', 'chapters': [{'end': 883.391, 'start': 750.143, 'title': 'Resource bash rc file for proper cursor handling', 'summary': 'Illustrates the process of sourcing the bash rc file for proper cursor handling by using special escape characters to resolve cursor position issues and implementing prompt setup code.', 'duration': 133.248, 'highlights': ['The process involves using special escape characters to resolve cursor position issues, ensuring proper cursor handling in the terminal.', 'Implementing prompt setup code to customize the appearance of the terminal and resolve any cursor position anomalies.', 'The tutorial emphasizes the importance of using escape characters and prompt setup code for a seamless terminal experience.']}, {'end': 1107.454, 'start': 883.891, 'title': 'Customizing bash prompt with ps1 variable', 'summary': 'Discusses customizing the bash prompt using the ps1 variable, showcasing the use of tput commands, setting variables for colors, and using dot files for advanced customizations, with a hint of future videos on dot files and github dot file exploration.', 'duration': 223.563, 'highlights': ['The chapter discusses customizing the Bash prompt using the PS1 variable. The transcript focuses on customizing the Bash prompt using the PS1 variable to set different colors and formatting for the terminal prompt.', 'Showcasing the use of TPUT commands and setting variables for colors. The transcript explains the use of TPUT commands and setting variables for various colors like orange, yellow, bold, and reset to customize the terminal prompt.', 'Using dot files for advanced customizations and hinting at future videos on dot files and GitHub dot file exploration. The discussion hints at future videos on dot files, exploring advanced customizations, and leveraging GitHub to download and analyze popular dot files for powerful customizations.']}], 'duration': 357.311, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/LXgXV7YmSiU/pics/LXgXV7YmSiU750143.jpg', 'highlights': ['Using special escape characters for proper cursor handling in the terminal.', 'Customizing the Bash prompt using the PS1 variable for different colors and formatting.', 'Explaining the use of TPUT commands and setting variables for various colors like orange, yellow, bold, and reset.', 'Leveraging dot files for advanced customizations and hinting at future videos on dot files and GitHub dot file exploration.']}], 'highlights': ['Demonstrates using command substitution with the tput command to incorporate color into the prompt.', 'Illustrates applying colors to text and the terminal prompt using the tput command.', 'Customizing the Bash prompt using the PS1 variable for different colors and formatting.', 'Using special escape characters for proper cursor handling in the terminal.', 'The process involves modifying the bash rc file and editing the PS1 variable to customize the terminal prompt.', 'Explaining the use of TPUT commands and setting variables for various colors like orange, yellow, bold, and reset.', 'Demonstrates a simple example of customizing the prompt by adding an arrow and creating space after it.', 'Refers to using a 256 color chart for color references and obtaining the color value of 166 for orange.', 'Leveraging dot files for advanced customizations and hinting at future videos on dot files and GitHub dot file exploration.', 'The chapter explains customizing the Bash prompt with dynamic information like username, host name, and working directory using special escaped characters.']}