Custom Bash config - Set up of .bashrc/.inputrc files for a fast and efficient shell experience

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on all you beautiful people thank you for taking a few minutes of your important day and your busy lives to watch one of my videos it is greatly appreciated um if you've watched some before and you found them interesting or helpful or even just a little entertaining i appreciate it uh thanks for checking this one out if you aren't a subscriber man just like any other channel out there that's trying to grow i would greatly appreciate if you liked it if you would subscribe and help me out help my channel grow and let's get this thing off the ground so again i appreciate any any likes and comments you want to throw my way and please subscribe and hit that notification bell uh let's get into what i want to talk about today um today is a pretty simple uh video it's not going to be real long so i was kind of going through my system doing some cleanup like i like to do and i realized that when i first started linux i stayed in bash for a real brief period of time just enough to set up a few things and start using it and then lo and behold zsh came along with all its prettiness and this and that i shouldn't say it came along but that was introduced to me with all its prettiness and neat features and all this and instead of just kind of sticking it out with bash and learning how to do this stuff in bash i jumped ship and went over to zsh was on zsh for a while and then jumped ship again over to fish for a little bit um and then back to zsa and zsh is where i've spent the lion's share of my linux career when it comes to a shell or zsh zsh z shell z whatever you want to call it where whatever you prefer that's the one i was in i call it zsh but that's where i lived today i was kind of going through my files and just kind of looking through some stuff and i decided i think i'm going to go back to bash and we're going to give give bash another go since i didn't give it a fair shake to begin with and i just kind of wanted to go over a little bit of my bash rc and my dot input rc and kind of show you how i got things set up so if we open a terminal here we're going to launch the st terminal and if we go into my dot bash rc um you can see here it's pretty similar probably to most people's um not nothing real exciting about it um if you saw my zsh video on how i have my zsh config setup this is pretty much the identical configuration file um see i've got my browser my editor set up up here for my path it launches neofetch because well excuse me uh like i said i like pretty things so a little bit of bling in the terminal to uh when i launched to start it off i got my prompt here it's just a real simple prompt um as you can see here i've got it set there um and then i've got my aliases uh the difference between this and my zshrc is my zshrc i basically took all my aliases and i put them in their own file and then i source that file from my.cshrc just to kind of keep it cleaned up a little bit because well this is a lot of aliases i have stuff for git for fortune and cow say for my pictures my wallpapers uh for configuration files that i go through quite often right here um for youtube excuse me um to switch back and forth between bash csh and fish um just all kinds of stuff to log into my web server so again just real basic stuff in my bash rc stuff everybody's got in their aliases and stuff like that um i do have like ls and ll and la set to lsd i wanted a little bit more color in my uh in the terminal whereas you know when you bash is usually pretty colorless so if you use lsd in a aliased ls to lsd if you hit ls now i've got some color and some icons going on in there so um they're colored based on file and there's icons um so and then if i do ll that gives me you know all my permissions so just a little more color just to make it a little more enticing when you get in there some people like color some people don't like i said i like pretty things so well that sounds horrible sound uh huh i pride myself on being uh you know pretty manly guy i'm i'm an automotive technician i've worked with my hands my entire life and here i am talking about like pretty things anyway that's it that's a different that's a different story so um yeah that's basically my bash rc it's real simple it is i believe over on my github and my gitlab if you want to check it out there's nothing special about it but that's that so if we quit out of that the one the other file i wanted to talk about was that taught input rc so i've got cute browser up here and if we go to the archwiki if you're on an archbase system um go to the archwiki and you look up if you type in the search you can top it type in dot input rc i'm sure you can type in readline 2 if you want but this is the file that's going or this is the page that's going to come up and it's pretty freaking cool the stuff you can do in here this has all kinds of functions in bash that i think a lot of people aren't aware of or ignore or just don't bother taking the time to check out and set but this has been a lifesaver for me and i guess not lifesaver it's you know i'm lazy so i guess lifesaver for me because any energy exerted that uh doesn't need to be exerted is uh uh anyway so i definitely recommend checking this out um again you can type in dot input rc or you can i'm sure type in readline and take this page and check it out so let's go check out my dot input rc file so if we relaunch the terminal and we vim into my dot input our not input and put rc golly i can't type um it's pretty small file for me um there's a lot more you can add to it but i've just kind of got some few a few things that uh i wanted to have set um like up here i've got some stuff for purifying my as you see right there pretty fi purifying my my output so if we launch the terminal up here another instance of it and these right here are for my completion so if i type in say type in cd space and then i hit tab well we can see here that i have everything that you can see the into and it's all colored well basically show all of ambiguous right here when i did that the cd tab it instantly brought them up this is kind of redundancy because technically if you do let's comment that out and we write it and we quit out of that we relaunched that terminal now we're going to cd space and hit tab okay we got nothing right well if we hit tab again we've got exactly what we had come up when we had when we had this right here uncommented but again being the lazy person i am if i if i don't have to hit tab twice then why would i so if we rewrite that we close out that terminal we relaunch it and we hit cd space and we hit tab now we only have to hit the tab one time so that saved me a whole maybe 100 of a second but you know what each 100th of a second counts right um also the set completion ignore case so if i type in let's say i do cd and i do a lowercase d and i hit tab well as you can see here i typed in cd lowercase d but it also lists out any directories that start with a capital d as well and then if i take that one farther and i do d-o-w and i hit tab it's going to automatically complete even though i typed in a lowercase d and not a capital d so the ignore case is kind of nice because i don't have to worry about case so much these up here the colored stats and the color prefix basically if i do vim dot and i hit tab you can see the uh colored completion prefix well if you look here you can see i typed in bin and then i hit period before i hit tab well all the periods are one color so if i was to type in i vim period i and hit tab again you can see the period in the ir so anything that i've typed in that matches is going to be highlighted in a different color now the colored stats on basically what that does is you can see that icons here you can see the slash after the icons is a directory and it's colored green and pink whereas input rc is a file and it's white and pink so this set colored stats on basically what that does is when i hit the tab button it's going to show me that okay well anything white is going to be a file anything green is going to be a directory anything highlighted i believe is executable so there's just um or not um anyway it it basically sets colors so you can easily recognize what's a file what's a directory what's what so that's what that does um so these here that those are basically just for my completions um coloring them and making it so i can not worry about case and i cannot hit tap twice so pretty simple there the next ones these are the ones that are the lifesavers so right now let's see if i type in history that's going to show me a history of all my commands correct so we all know that you type in history it's going to give you a history of all your commands we also know that if you just press the up arrow it's going to scroll back through your history one entry at a time and you can do that until you find the one you want yadda yadda well if you already know like okay i want to go back to what was it i typed in this command and it was you know fairly long um so i need to go back to that well this right here basically what that does is set up if i do if i start typing the command like say i remember well i know it started with an s so i type in that s and then i hit up what that does is that takes me back to the first command right there that started with an s it doesn't start me back one at a time and take me back to that one and then if i hit up again it takes me to the next one back that starts the next the next one back that starts with an s so these are life savers these are great i don't have to scan back through everything i don't have to type the history command and find which one it was and then type in the it's just i remember it started with an s i hit s and it'll scroll through those ones and that drastically narrows down finding the command which is awesome so that is a wonderful wonderful tool to have in your bash input rc file for bash so let's clear the screen here now these down here these are probably my favorite these are here on my bash key bindings and if you didn't know bash had keybindings again check out that page in the archwiki or whatever documentation you have for the district you're on and look for the input dot input rc file and for bash and these are live savers so basically what i have set up here is if i want to get to my config directory no matter where i'm at in my file system let's do cd root so that puts me in the root directory if i want to get to my.config directory all i have to press is ctrl f control f cds me right into my dot config directory no matter where i'm at in my file system um cd sh or cdh i can't i can't talk ctrl h excuse me no matter where i'm at in my file system just like the other one if i type control h control h is just going to take me home takes me straight back to my home directory if i type c or control w control w is going to launch my web server [Music] and then the other one i like is if i hit control f and then let's do cd poly bar and then cd script so i'm down a couple directories deep if i want to go up to the next file you know you can type in cd dot dot or you can alias dot dot or whatever you want to it and type that alias or you can do what i've done here and i have actually bound control b to cd dot dot so if i hit ctrl b it takes me up up up up up so as many times as i hit control b it's just going to keep taking me up and then hope i went too far let's go back home we'll hit ctrl h so moving around the file system in bash is amazing when it comes to this when you have your key binding set now one last thing this one's a big time saver because how many times have you been doing something and you type in i need to update my system and you type in s oh shoot i forgot to hit sudo now you can hit enter it's going to scream at you that you didn't use root privileges and then type bang bang and have it all good okay you can go that route if you want which is easy enough but i haven't hit enter yet i don't want to go through all those steps i have right here alt s set to okay i've typed in sudo pac-man dash sy what i do now oh shoot well let's just hit alt s oh now i've got pseudo amended to the front excuse me appended to the front of my command i can hit enter and enter my password and we're good to go so again that's alt s i have set up to add sudo so if i hit alt s it's just going to append sudo to the beginning of any command i have already started to type so again to do those you basically just quote double quotes and you do a backslash and then the control capital c for control and then you pick your key and like i said i have dash f so control f and then close the quotes and then colon and then double quotes and you put whatever you want it to do in there like here i have cd home slash jig slash dot config and then you do a backslash n for new line and then you close the parentheses and or you close the quotes and you're good to go so you set up your key bindings just like that however you want and whatever you want them for and you can move around the bash file system with just a quick press of a keybind just like the rest your window manager or desktop environment whatever you have them set up in so again these are just a few of the things that i have set up in bash that i find really helpful if you found them helpful and you didn't know about them great i hope you can get some use out of them if you already knew about them um great you're miles ahead of me um but yeah so just wanted to kind of touch on this and i hope you found this interesting or useful or entertaining or something and you didn't feel like you just wasted however many minutes your life and you're not going to get them back so thanks again for checking it out again if you haven't uh if you haven't subscribed already and you found this interesting please give me some thumbs up and comment maybe and subscribe to the channel it's greatly appreciated you guys all have a great evening and god bless
Info
Channel: Jake@Linux
Views: 507
Rating: undefined out of 5
Keywords: linux, terminal, linux terminal, bash, shell, bourne shell, bourne again shell, linux shell, command, command line, bashrc, .bashrc, readline, inputrc, .inputrc, bash configuration
Id: iKzoYUErEM0
Channel Id: undefined
Length: 15min 57sec (957 seconds)
Published: Sat Oct 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.