Тёмный

Customizing Your Terminal: Adding Color and Information to Your Prompt 

Corey Schafer
Подписаться 1,4 млн
Просмотров 205 тыс.
50% 1

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: • Customizing Your Termi...
Next Video on Dotfiles: • Customizing Your Termi...
256 Color Chart: upload.wikimed...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com...
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer

Опубликовано:

 

23 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 170   
@yash1152
@yash1152 2 года назад
== Start 0:00 Intro == Basics 0:08 modifying .bashrc file 0:33 prompt = PS1 variable 0:53 export PS1; 1:11 source (== environment??) 1:51 dynamic information examples 1:59 use corresponding escaped characters 2:36 cheatsheet 3:04 example illustration == Colors Intro 4:41 colors intro 5:16 command substitution 6:14 using tput with substitution 6:58 256 color chart == Colors Application 7:38 using it for PS1 8:08 resetting style 9:16 adding more colors == Script Maintenence 10:51 pretty printing the value 12:10 commenting in script 12:46 wrapping commands = Final Setup 14:04 Final setup's overview 14:43 specifying custom variables 15:39 quick go through == End 16:38 conclusion 17:00 dot files 18:10 outro
@heikoavalos1423
@heikoavalos1423 7 лет назад
Oh man this video is just awesome, I've never find out something so well explained and complete. This is exactly what i was looking for. I will subscribe right now. Thank you very much.
@a61763
@a61763 4 года назад
I really find your tutorials very well made, high quality, to the point and with a direct practical application! Thank you so much!
@ilakma
@ilakma 2 года назад
I just got a MacBook for work where I am training as a developer , and my environment was all messed up. These videos were so helpful! Thank you! Legend.
@jcotteri
@jcotteri 6 лет назад
This video explanation is seriously excellent. Thank you Corey S.
@mau_lopez
@mau_lopez 5 лет назад
Really useful video, I didn't do the colors substitutions but having the user and directory names in one line and the prompt in another one and a blank line in between commands are absolutely useful for me! Thanks a lot Corey
@binhna
@binhna 6 лет назад
Now I know how to customize my terminal! Great stuff man! Keep doing it!
@isaacmaag1294
@isaacmaag1294 3 года назад
The BEST video about this. Love the detail. Seriously man great work.
@tcarney57
@tcarney57 6 лет назад
Very cool. I discovered, though, that the bash that came with my Kubuntu 16 doesn't do 256 colors--at least as currently configured. It will only do 8: 0=Black, 1=Red, 2=Green, 3=Yellow, 4=Blue, 5=Magenta, 6=Cyan, 7=White, 8 [Not used], 9=Reset to default color. I won't bother to see if I can set my bash to 256 colors--8 are fine for this purpose. I just thought I'd share this to save someone else the half hour it took me to figure out. BTW, you can see how many colors your bash will do (by default?) with: > *_tput colors_*
@ElektroDrrrEL
@ElektroDrrrEL 5 лет назад
Thank you very much - the superior quality of your videos - is just fantastic!
@daegudude1048
@daegudude1048 5 лет назад
Wow! now my terminal looks really dopey! Thanks!
@junioraos4074
@junioraos4074 8 месяцев назад
Thanks. This was very straight forward.
@amiaynarayan516
@amiaynarayan516 3 года назад
I don't know what my programming life would be without you corey, nothing but gratitude. How to manage branch name?
@yash1152
@yash1152 2 года назад
15:37 small : parenthesis curly : brace square : bracket
@kennethbass1915
@kennethbass1915 2 года назад
Always a lot of really good information and examples in plain language.
@jacobokomo1880
@jacobokomo1880 4 года назад
OMG Corey your videos are just awesome,explained and to the point... I just subscribed, liked almost all your videos and would comment in the comment section below.👏 Very nice staffs
@CassiusGiorgio
@CassiusGiorgio 5 лет назад
Great! Nice explanation and example! Thanks for sharing!
@baberali95
@baberali95 3 года назад
very nice explanation
@smithwill9952
@smithwill9952 4 года назад
Better than Lecture in University or tutorial session.
@realvolteon
@realvolteon 4 года назад
Thank you very much, when i saw your Video about grep i instantly noticed how cool your terminal looks :D
@aztecGin
@aztecGin 5 лет назад
Amazing video with great explanations! Got my sub, sir!
@manjuh9263
@manjuh9263 4 года назад
Explanation in my level of understanding.. thank you
@jumanjiwarlord
@jumanjiwarlord 4 года назад
Good stuff. 👍 It pointed me in the right direction to get my terminal looking nice.
@melis4896
@melis4896 4 года назад
this is scarily clear. thanks man!
@kingjokeking
@kingjokeking 5 лет назад
awesome.. im addicted to Linux Commands.. So much fun
@d1k987
@d1k987 4 года назад
This is a really good tutorial. Thank you
@pwlai1268
@pwlai1268 4 года назад
Awesome!! Love this!! Thanks a lot!!!!
@peanutbutter8885
@peanutbutter8885 3 года назад
Thanks Man.
@aronfischer-sigl2401
@aronfischer-sigl2401 4 года назад
Great video thanks for sharing. I have one question, how can I add some margin to the bottom of my terminal, so that I never have to type at the bottom of my screen?
@bonvoyage7
@bonvoyage7 4 месяца назад
@coreyms, It was a great video. I have a question, I wanted to change the color of the foreground text after using any command. Like for example I will use the command 'ls' which will show the list of files and directories in a specific path that I am currently in, so I want those list (files and directories) should show in a specific color, how to do it? tput sgr0 - i removed this and tried but in this case entire thing changes its color but I want specific color only to the result of a command (ex: 'ls')
@habibmgadmi926
@habibmgadmi926 5 лет назад
Awesome, Thanks, Corey!
@michaelkeymont501
@michaelkeymont501 5 лет назад
Spectacular!!!
@srinivas941000
@srinivas941000 4 года назад
Thank you. This video was really enlightening. I am a beginner in the terminal world. I would like to know how to customize the terminal so that different kind of files shows up in different color...for eg - executable files in one color and normal files in other colors depending on their extension.
@brandonllsha
@brandonllsha 4 года назад
Awesome but can you drop another tutorial talking about where to find the commands and stuff like that for z shell or for zsh? Loved the tutorial though!
@ercntreras
@ercntreras 3 года назад
did you find it how to do it?
@patrollaallens.43
@patrollaallens.43 2 года назад
Thank you so much. :)
@irenes5014
@irenes5014 2 года назад
Hi! This is amazing! However, when I run SSH, all of my customisations disappear! How can I make my Terminal copy the customisations over when I access my uni network?
@janosmarton7895
@janosmarton7895 2 года назад
When you said, I am just gonna push this to the side at 3:22, then magic happened, and your text editor just formatted itself to share the screen. How did you do that?
@amraly759
@amraly759 7 лет назад
Great series thank you .
@ercntreras
@ercntreras 3 года назад
Thanks!! Corey
@AlexBrykalov
@AlexBrykalov 8 лет назад
Great tutorial. I have a question: How to change the color of folders when you press ls command? So I want that color of files stay the same and the folder's color change. It would be easy to see where is folders and where is files
@justinstar9710
@justinstar9710 7 лет назад
neat and clean vid, thank you!
@HuangZemin-oy7hd
@HuangZemin-oy7hd Год назад
HI! the color only appears when I source .bashrc. When I open a new terminal, the changes are gone, how do I solve this?
@PoeLemic
@PoeLemic 4 года назад
I loved this video. I sure wish you would have put the code at 14:36 in the description where we could play with it. Again, thank you for sharing your knowledge. I wish that I knew as much about Linux as you and Chris Titus do. Very impressive.
@adamlang1368
@adamlang1368 3 года назад
Very good video dude! I have one question though, how do I save these changes permanently? When I close the terminal and reopen it, it kinda resets everything to "normal state" meaning that I have to cd to my .bashrc file and run the command for the changes to be working.
@dalton7062
@dalton7062 4 года назад
Great videos! Is there a way to make the output of a command a different color, or even just default white? I've looked a few places and couldn't find a simplified explanation such as your videos have. Basically, I'm wanting my prompt to be one color(s), and then when I type in a command (like ls -la), I want the output of that to be white (or whatever color).
@vaibhavsolanki8953
@vaibhavsolanki8953 3 месяца назад
Hi I am getting a the folloeing error: PS1: Command not found. export: Command not found. When I am sourcing the file with intial two commands
@mohan5v5988
@mohan5v5988 4 года назад
Great Video!!! Thanks For explaining very nicely. I'm using macOS Catalina when I just try to modify the PS1 to "\u -> " and source it or reopen the terminal I'm getting \u instead of my user name. any help is really appreciated. Thank You.
@anubhabtarafder5501
@anubhabtarafder5501 4 года назад
I'm also facing this same situation!
@mohan5v5988
@mohan5v5988 4 года назад
@@anubhabtarafder5501 the default terminal for Catalina is z shell so bash don't work look at z shell videos
@moonnoon1415
@moonnoon1415 4 года назад
Use % instead of \ and { instead of [ ex: %{$(tput setaf 214)%} everything else is pretty much the same :)
@archieyoder
@archieyoder 3 года назад
@@moonnoon1415 Not working...
@saketsaumya808
@saketsaumya808 2 года назад
Hey did it work.. Same problem with me ??
@jixuancheng
@jixuancheng 7 лет назад
So good!
@DiceCrypto
@DiceCrypto 4 года назад
IF THIS DOESNT WORK FOR YOU: -make a .zshrc file in home directory -edit that as you would .bashrc
@JJordanov945
@JJordanov945 4 года назад
You're a lifesaver.
@OlliePage
@OlliePage 4 года назад
is this meant to solve the problem of the escaped characters not expanding? because if so then it isn't working for me. Both .zshrc and .bashrc work for changing the static letters though. Any ideas on how to fix the expanding issue?
@Ash_Industries
@Ash_Industries 4 года назад
​@@OlliePage the .zshrc files use different escape keys. Check out this tutorial. I still used PS1 and export PS1 but used the different escape keys and it worked. scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/ Also this tutorial links to the zsh docs with all the available escape keys (idk if this is the correct way, but it worked for me).
@TheMadHaxor
@TheMadHaxor 6 лет назад
Hey, nice video series, it's not in a playlist btw ;) Question, how can I change the HOME directory (bashFiels to a folder in the USER folder, without having and bash files in the USER folder to redirect to the USER/bashFiles ? using windows just incase my files system path looks off
@CasiodorusRex
@CasiodorusRex 2 года назад
Logged in a root, but can't insert a line after vim:ts=4:sw=4 Any ideas on what I'm doing wrong?
@chenalex8710
@chenalex8710 7 лет назад
Do you know why there is a '[' appearing after press entry in the beginning of previous line?
@ecptavares
@ecptavares 3 года назад
Everytime I do this it show the string \u and whatever \letter I use.How to make this change the prompt.It is not working for my kali linux thx
@Shriekin_Commander
@Shriekin_Commander 2 года назад
Can anyone explain what the \[ and the \] are actually doing in Corey's bash commands?
@peacemekka
@peacemekka 3 года назад
Nice. Never knew how to do it with tput. Been using '\e[' to do it. Works a lot better with esc seq tbh but still this is way more readable. Also could you make a video on the PROMPT_COMMAND variable? I've heard you can setup custom functions inside this and then make PS1 print out even more useful stuff.
@japoneon8915
@japoneon8915 6 лет назад
Best video man ty 🤗
@rodolfomarques3683
@rodolfomarques3683 5 лет назад
Great video! I used your method to customized my prompt colors and it worked like a charm. However when I type the su command to log the root user I get my customized color scheme. My distribution defaults a root prompt red and I would like to keep that setting. How could I change my user prompt while keeping the root prompt with my distro defaults?
@estebonify
@estebonify 2 года назад
Hello Corey, I'm a big fan trying to learn python from your tutorials. Today I made a major mistake; I went into my .zshrc file, uncommented line 51; now when I open the terminal it opens for approx. 2 sec. and closes. Here is the message (/Users/admin/.zshrc:51:uncomment) but screen is frozen, for 2 seconds, then nothing. Is there any advice? Thanks in advance.
@CGKittenz
@CGKittenz 2 года назад
The special characters (like \u etc) do not work for me at all (MacOS Catalina). Could someone tell me where I get these?
@matthiasgayaud6284
@matthiasgayaud6284 7 лет назад
very useful thank you
@Kruiger1993
@Kruiger1993 6 лет назад
Hey Corey and you explain how did you copy into 4 rows at the same time and most importantly how do i make the changes permanent??? Thanks
@kluchtube7042
@kluchtube7042 3 года назад
does this work for the linux as well?
@dhavalprajapati660
@dhavalprajapati660 3 года назад
Is this video for a windows user? I am using windows command prompt and I don't know if it has the bash script. Can anyone please help!
@kennyiraheta8088
@kennyiraheta8088 6 лет назад
Hi Corey. How do you display an active virtualenv in the bash prompt?
@LookNumber9
@LookNumber9 6 лет назад
In Ubuntu 18.04, I now seem to be getting "No value for $TERM and no -T specified" after login and before startup. The prompt still has all the colors and changes I made - and everything seems to work fine. Is the warning a result of these changes? And if so, is there a fix?
@jacobokomo1880
@jacobokomo1880 4 года назад
Hello Mark I persistently do get the same issue as yours. I'm in Ubuntu 18.04 as well.Kindly do share with me if at all you found a fix for it Sir. Feel free to reply here or to okomojacob2030@gmail.com
@nageshvagicharla
@nageshvagicharla 3 года назад
Hey Corey, can you please make a video in zsh. Cause when I’m doing the same thing in zsh, it is giving me incorrect results. Thanks
@FranVarVar
@FranVarVar 6 лет назад
Hi Corey. Shouldn't $ change to # when logged in as root? Thanks for your videos.
@IsaacLuz
@IsaacLuz 5 лет назад
Not sure about it, but i just found this answer to same question stackoverflow.com/questions/23414407/bash-ps1-shows-instead-of-for-root
@maddoxmayer2475
@maddoxmayer2475 6 лет назад
What font and size do you use in Terminal? Can you show the settings?
@coreyms
@coreyms 6 лет назад
I use Source Code Pro. The font size varies depending on if I'm recording or using it regularly.
@abhigugulothu5292
@abhigugulothu5292 3 года назад
When i type ls output of my dir background color is green i want to change it Please help me in making a video in it
@pegcailla4625
@pegcailla4625 5 лет назад
too good yo
@henricattoire8507
@henricattoire8507 7 лет назад
Can i remove this command line (Last login: Sun Jul 9 18:17:29 on ttys000) who keeps showing up?
@hetvikam4754
@hetvikam4754 3 года назад
touch .hushlogin
@royemi
@royemi 8 лет назад
Thank you!
@afridi2482
@afridi2482 4 года назад
Getting this error -bash: PS1: command not found any idea ?
@melis4896
@melis4896 4 года назад
Is there a space after PS1=, that may cause it? The form should be PS1="..."; at least it was the case for me. But if not, I think it is probably syntax :)
@emmonspatzer8113
@emmonspatzer8113 5 лет назад
Command Not Found error - Everything runs. I have the .bash_profile calling the .bashrc and it also calls the .bash_prompt from your next video on the Github options. The command does the right color coding and the Github worked to even do an install of its application. I am doing this all on a Mac Mini connected as a MAMP installed server set up on a local network and I can work that server via Screen Sharing from a Macbook Pro. I have: export PATH=/Applications/MAMP/bin/php/php7.0.8/bin:$PATH a an extra line in the .bashrc because I am using it to shift to a more current version of php than my native Mac version because I have it installed with Drupal 8. I have tried remarking it out, I have changed the order, I have added another export PATH around the initial bash calls and moved the more current php version call to the end to see if processing order and potential command differences between php version might be why I am getting the Command Not Found error. Like I said, all the functionality seems to work in the sense that the prompt changes are in place and php -v confirms the version update has run; but I still have a "Command Not Found" showing up before I see the modified prompt. I don't know if there are spaces or something in one set of commands in your video's that I am miss judging in this area ... if [ -f ~/.bash_prompt ]; then source ~/.bash_prompt fi Or do you have other thoughts as to the cause and what I should try.
@anand_dudi
@anand_dudi 3 года назад
thanks please upload video for shell scripting sir
@judahpeirsones1971
@judahpeirsones1971 3 года назад
P.S you can write and run the code to edit your Terminal In the Terminal
@ClownCardinal
@ClownCardinal 7 лет назад
the colour looks great but when I start typing a command and then press backspace to the start of the line the entire line disappears. I can still type the command and there it doesn't produce and functional errors and the line reappears when I just press enter but it's annoying to work with. Do you have an idea as to what may be the problem? (I'm on mac). And thanks for the tutorial !
@coreyms
@coreyms 7 лет назад
Hmm, it sounds like something may be a little off there. Not sure what it could be, but it's easy to have typos in the dotfiles that create weird behaviors. My preferred method is to download a dotfile from someone else that has been evaluated by many people and then customize it to my needs. Have you watched my video on that? You may find it more helpful
@ClownCardinal
@ClownCardinal 7 лет назад
Thank you for the reply! I did manage to fix it but I don't know why. In case anyone else has the same problem, what I did originally was I put only one of \[ and \] at the very beginning and at the very end. I tried putting \[ and \] around each tput command and it was fixed!
@dhirendrapatil1401
@dhirendrapatil1401 7 лет назад
How can change the background of the terminal for CLI mode for the remote access. ..?
@coreyms
@coreyms 7 лет назад
If you update your server's bashrc file then it should have the same result.
@hamidurrahman3183
@hamidurrahman3183 6 лет назад
how do I make an alias to open any file? Like I want an alias o="open name.extension"
@boatyuan4970
@boatyuan4970 6 лет назад
It seems that tput doesn't work in High Sierra, I can't change the color
@mikespencer9913
@mikespencer9913 6 лет назад
I'm running High Sierra and it works just fine. Check the syntax VERY carefully!
@lhakpatenjingsherpa9182
@lhakpatenjingsherpa9182 7 лет назад
all my commands in the terminal are displayed in the same line.. what might be the problem?
@lianzhengfang6714
@lianzhengfang6714 7 лет назад
$(tput sgr0); added?
@cayanaraycaudhuri
@cayanaraycaudhuri 4 года назад
My bashrc file is already populated, so none of these are working.
@yunshunzhong4491
@yunshunzhong4491 3 года назад
That's a great video! But when I did the same in mac Big Sur the terminal only prompts the literal "/u" etc instead of username. Is there a way to solve this?
@kevinjoe400
@kevinjoe400 3 года назад
try "\u"
@joebyjo
@joebyjo 3 года назад
you're prolly using zsh
@saketsaumya808
@saketsaumya808 2 года назад
Hey did it work.. Same problem with me ??
@josuedaniel5777
@josuedaniel5777 6 лет назад
Someone can help me? Everything works fine but i'd like to customize the branch name color too but i don't know exactly how to do that ...
@MrDextre1480
@MrDextre1480 5 лет назад
hello and how can I do to make the sign $ change to # when I enter like super user? please thank you
@IsaacLuz
@IsaacLuz 5 лет назад
Not sure about it, but i just found this answer to same question stackoverflow.com/questions/23414407/bash-ps1-shows-instead-of-for-root
@Lowzenza4
@Lowzenza4 6 лет назад
Make a bash scripting series! :)
@ca7986
@ca7986 3 года назад
❤️
@lalalalong
@lalalalong 7 лет назад
how do i make the file run automatically without having to type .bashrc everytime?
@luiscortes6563
@luiscortes6563 6 лет назад
You can simply just copy it to your .bash_profile.
@roughr4044
@roughr4044 5 лет назад
@@luiscortes6563 thanks 👍
@vasyldemianiuk6663
@vasyldemianiuk6663 7 лет назад
Can I do syntax highlighting for sql ?
@marlhex6280
@marlhex6280 4 года назад
Can you do a video for zsh? same colours :D
@andreagenor
@andreagenor 6 лет назад
Did you try it on macOS High Sierra? It's not working for me
@Cabanas751Dunhill
@Cabanas751Dunhill 6 лет назад
It working fine
@yash1152
@yash1152 2 года назад
2:36 cheatsheet
@ogoeroige9015
@ogoeroige9015 2 года назад
Why does mine not even show my username, if I put this PS1="\u@\h \W -> " this is the actual outcome in the command line: \u@\h \W ->
@shivambarot9446
@shivambarot9446 5 лет назад
How to print path of current working directory instead of \W?
@parth_raghav
@parth_raghav 5 лет назад
insert $(pwd) instead of \W
@cross9688
@cross9688 2 года назад
@@parth_raghav don't know why, \W didn't work for me, it just showed up literally as "\W"
@celestialbeing4767
@celestialbeing4767 4 года назад
I'm all over place.
@shuvroroy6289
@shuvroroy6289 8 лет назад
\w don't work on my mac terminal
@MyurrDurr
@MyurrDurr 7 лет назад
Shuvro Roy It didn't work in my Linux terminal either But W does! how odd
@malharjajoo7393
@malharjajoo7393 7 лет назад
Doesnt work. Get spoilt when you do reverse search
@sanikathorat9760
@sanikathorat9760 6 лет назад
Run CPP asm program in bash
@codefred1383
@codefred1383 4 года назад
Awesome stuff! PS1+ = "\[${THUMBS UP}\]"
@michaellarcombe
@michaellarcombe 7 лет назад
Why do you use export PS1; ?
@coreyms
@coreyms 7 лет назад
PS1 is what changes your prompt (what is displayed before your command).
@michaellarcombe
@michaellarcombe 7 лет назад
But what's the purpose of exporting it? Where does it export to? I was able to change the prompt just as you did without having to write export PS1; As far as I know it behaved the same without it.
@ywoak3288
@ywoak3288 5 лет назад
Michael Larcombe export put it as an env variables
Далее
4 YEAR SIBLING DIFFERENCE! 😭 #shorts
00:11
Просмотров 13 млн
Giant Silver Chocolates ASMR With My Sister! 🤤
00:46
Rating 5 Most Popular Terminal Color Schemes
15:04
Просмотров 187 тыс.
Customize & Colorize Your Bash Prompt/Terminal
18:13
Просмотров 48 тыс.
Linux Tip | How to Customize Your BASH Environment
35:31
Ten Attractive Fonts For Your Terminal Or Text Editor
18:46
Add Color to your Prompt Linux Bash Shell
11:57
Просмотров 10 тыс.
5 Awesome Linux Terminal Tools You Must Know
23:05
Просмотров 290 тыс.
Linux Crash Course - The df and du Commands
20:28
Просмотров 29 тыс.