The Ultimate PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the ultimate poers shell experience is here and I've been working on this for the last couple days and one thing with Powershell is I love the experience once you've taken out the the craziness of of Microsoft and you've made a lot of like easy aliases to where you can get around and navigate your prompt I've already made a video about like zide navigating instead of just using CD and this one I really wanted to kind of take it to the next level with Powershell a lot of times things get out of date in Windows and one thing I wanted to do with my Powershell profile is One automatically update it I'm tired of going out and checking and then going okay let me load up my toolbox and then we'll update Powershell or maybe I'll click on the update from Powershell and the Windows update and then have to click through a couple boxes none of that I just want it to automatically happen and I've made some big changes to that actual profile itself so on launch what I do is let's say I launch Powershell what it does is it goes out checks for any profile updates downloads them if need be and then also checks for Powershell updates now in the past this could cause Loops if you didn't have an internet connection or anything like that but uh with this giant refactor I've done of my base Powershell script the first thing I would do is do a test connection to github.com if you can't resolve github.com it'll go ahead and Skip obviously try trying to look for a profile update or doing a Powershell update because all this is done from GitHub and if you don't have an internet connection I don't want it to just sit there and be like I'm waiting for an internet connection before launching the Powershell because a lot of times troubleshooting the internet is done on a poell prompt so I wanted to make sure that was still there capability obviously integration of like terminal icons and adding a lot more error checking into this profile so when it comes to terminal uh icons oh my Posh zide all these Cool Tools that I show in all my videos and how I navigate around well let's say you load this profile and that stuff isn't installed on your computer or there's a big update and it's a different version or whatever I put error checks into one either install it if it's not there already or update it if it's out of date so it'll just automatically do this for you so there's no problem with actually loading it does make the load process a little bit longer as I have been sitting here looking at that but it's usually between uh 1 second to two seconds for a launch and I'm okay sacrificing that as long as I can maintain everything and not have to go out and find stuff because usually I just leave this prompt open and then navigate back and forth between the different tabs I have going so if I'm on like Z web and then I just do a get pull this is usually how I manage my stuff as far as like certain aliases I've set up I usually set an alias for Vim and that Vim will translate to neovim if it exists or P Vim or regular Vim or VI or code or notepad++ Sublime Tex or even notepad if it doesn't have anything and everyone has notepad so that's how I've like set up the editor uh alias in here other big Alias is like finding files sometimes sucks because of powers shelf you know how it's set up like if I'm over here and I'm like gosh I need to look for oh let's go you what what do I have for YouTube okay those are all the YouTube articles I've written on my website and their full path names uh and it just makes it way easier than trying to do get child item and then recursively searching using this crazy command where it's just so much easier with these aliases if I want to grab my public I IP I can just go get- puu IP I'm not going to bother running that just because well it wouldn't show much because I got to blur out that if I go up time this is a Linux command but it shows when this was actually launched you can see just recently I've uh launched this system if I have any changes to my profile I can also just go reload profile it just checks for updates and then reloads everything unzip commands I just added that again most of this is Linux based stuff uh another thing that I really wanted to do was have a proper Hast spin whenever I'm doing live streams over on Twitch I'm like okay or Titus Tech talk if you're a YouTube guy uh or gal this is what I want to do I want to be able to easily share code with you the audience quickly and I don't want to be able to like copy paste into like a a paste bin online or something like that or or having to do like a GitHub gist it just takes too long and and when I'm sitting here and I'm like okay you know what let's jump over to Powershell in my Powershell profile I have these different things now I've changed my entire profile file around but let's say I want to send you the current profile as it is 201 today uh I'm just going to go Microsoft PS1 what this is going to do is upload it to my hastebin servers and then give me a sharable URL so if I click on this it launches into bin. Christ titus. comom we're going to go ahead and hit continue and this is going to be my entire Powershell profile and I I I was using .io and then that moved on to hpin but then they got bought out by a different company I've gone through a bunch of different services and all of them keep getting shut down so I'm just like you know what if you they can't do it I'm just going to host and do it all myself so if you do want to use my hastebin server you can bin. Christ titus. comom uh it's all unsecured it it don't put anything here that's sensitive because it could be shared with the world obviously but I made this just so I could share code easily with everybody uh obviously if it gets abused I'll have to take it down but I think uh for the people that watch me and that want to use this have at it should be good uh I don't I don't anticipate anything I threw about a 100 gigs and pay a little bit per month just to host everything on this server but I wanted something to where I know it'll exist and if it doesn't exist I'm the one that took it down and that's why I created my own Hast spin server but also I made this Hast spin Alias so I can just do HB and the file name and it'll just share it with you so if it's a a source file or something like that I can just make that and send it directly to anybody in chat or in a YouTube video I could easily just do that if you wanted to download it directly and then just some other uh Linux stuff like uh DF if you've never used dis free in Linux uh let's just go DF and you should see uh all the current files and how much size each drive has and how much space is attached to each one which command it just kind of gives you a detailed layout of commands and where it's at export this just gives you a a value so you want to export a let's say Editor to change that Global variable to something else you can do it with the export command by default you have to do this set item or maybe you go like CIS dm. CPL and put it directly into Windows permanently you could do it that way and then adding pill and just a head and the tail uh for just grabbing like the first lines of a file or the bottom lines of a file these are just really basic commands that are everywhere in Linux and I use them all the time but I really miss them when I'm in Powershell but no longer because this profile kind of takes care of that uh I have a couple other like just shortcut keys most of this could be taken care of with zide this is probably overkilled but it's there in in case I need it and then an LA and an LL uh for a long listing with hidden files and then the LA is probably just a a a regular long listing as regular so showing that like here's an LA and then an LL so the big thing here is the LA I I really use La a ton and I love just the listing icons these are actually terminal icons and I might need to change my font a little bit on this system because it doesn't look like it's pulling in some of it but uh another thing too when you're doing like a set execution policy unrestricted you notice how the font gets colored as it's going through well that's because it says okay this is a command we're going to Yellow that and then it actually colors the command as you go through so it makes it way more readable uh here's a whole bunch of git commands I like to use like lazy G for doing commits a lot of times uh we have flush DNS so easy to flush your DNS which do all the time in Windows but here's the PS read option I added this for The Coloring of a commands yellow a parameter green and then a string is just going to be that that dark C color that you saw and then finally pimping out the prompt making it look good and that's where the oh my Posh comes in and for that I always set I I like to use Windows terminal or WT quite a bit these days in settings under defaults go to appearance and then you set anything to like a nerd font I'm just going to go to downloads from nerd fonts.com and you can kind of pick out any nerd font from here that'll have like all the next stuff uh Cascadia Co is probably the my next favorite one so I'm just going to click download here all right with all those extracted what I like to do is just highlight all uh oh highlight all rightclick and then just say install for all users if you don't have that installed for all users you have to go to Advanced and or show old options uh because you're on Windows 11 and with that done these should be installed now on the system system so I'm going to close out of this come back into our terminal you can see we have this old font let's relaunch our terminal then we're going to go into our settings defaults appearance and now oh here's here's the nerd font that we want we want Cascadia Cove nerd font mono save that out close and now you can see our nerd font if we hit La you can see we're a little bit better let's go to Power LA and now we have proper uh if you're using terminal icons like I am that gives it these pretty icons Cascadia curve nerd fonts probably one of the best fonts out there even though on Linux I'm still a meslo LGS nerd font fan I can see here in talk about fonts for a while so let's let's just wrap this up I love this hopefully you use it if you want to see the source code or just Fork it and make it your own and do this for you not not having to rely on my updates or let's say you're like oh Titus you're doing something weird with this I I just want the profile and then do it Fork my GitHub project just come into github.com Chris tius Tech Powershell D profile and then just Fork this project make it your own I want you to steal this stuff it's so much better than having to go and manually update things I I also made and redid the inst entire startup script so I refactored all of this but the actual setup. PS1 should do most of what you need the only thing that you you still should probably set as defaults is going into like Windows terminal and setting that default appearance that I showed already in the video but the rest of this it'll install zide for you it'll go ahead and install like terminal icons and a lot of the modules that you're going to need to make your life livable on Powershell I don't know how anybody can deal with the stock Powershell experience especially you know the old Powershell much less Powershell core like we have with seven here and this should make everything for you set all your profile to where it is do a wind get install of oh my Posh and then refactor it it I've tried to install Cascadia code nde font as defaults here running the setup script sometimes it works sometimes it doesn't it just depends on your system and windows configuration it can be a little finicky but I wanted to show the manual method as well uh but this there's a good chance this will work as well overall I have enjoyed uh making Powershell livable because I really am Powershell a ton when I'm on Windows I can't live without my Powershell I know some windows guys like blasphemy the CLI is just for Linux users but when you really learn Powershell on Windows it's hard to do a lot of stuff manually because some some crazy people like come in here and they're like okay I'm going to go to settings and then I'm going to slowly find where's the search button to get back to the home feature oh is it in system and I don't know a lot of this just seems like pointless like changing the network out you'd have to come into here find your your network uh where's that at and then go into ethernet and then slowly find it and then I'm like you know what it's just easier to just give me an NCA cple and then sit there and modify the connection directly uh ah just so much faster anyways this is this is starting to become CLI Superior to goey and I don't want that uh sometimes guy is good for some stuff but for a lot of things I'm still still like give me the command line any day of the week so with that let me know your thoughts down in the comments and I'll see you in the next one
Info
Channel: Chris Titus Tech
Views: 50,333
Rating: undefined out of 5
Keywords: chris titus tech, powershell, windows powershell, powershell tutorial, powershell for beginners, learn powershell, powershell scripting, powershell basics, what is powershell, learning powershell, powershell training
Id: lePxtkrblRE
Channel Id: undefined
Length: 13min 37sec (817 seconds)
Published: Sat May 04 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.