ShellGPT: Never Leave the Terminal Again

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
everyone in here so I wanted to show you this really cool little tool that I found which is called shell GPT which allows you to use chat gbt in your terminal um and allows you to query any send any query as you would do over chat GPT and get a response back directly in your terminal without having to go through the chat gbt interface so if you've got access to the API enabled to generate your own keys this is a really useful way of interacting um with open AI and yeah I thought it would really just highlight it for you to have a play around with so I'm going to go install it with pipex Okay cool so now we've got a bunch of examples of things it can do here that are useful to us so just as developers um I've got a few things I've already tried so I thought I'd highlight so the first thing I'm going to do is ask it how many seconds there are in a day so common question that you might have um so it's asking for my open AI key there so I've already got it copied into the terminal if you've not got yours you want to head to platform Dot openai.com and you'll find it there I'm going to paste it in and it comes back with you should know this number if you are a developer um it should be right at the front of your mind but um yeah if you haven't you can just ask it a simple question like that um you can also ask it if we asked it something like [Music] how do I run um so let's say we run an nginx Docker image so it goes off asks and it'll come back and print it directly in our terminal so we don't have to go off and look it up on the interface so it comes back with a whole load of very verbose steps there which we're not really gonna want that we just want the command right we just need a command we don't need all this talk um still going wow okay but what we can do is we can pipe into this that actually what we're looking for is the shell command so you put dash dash shell how do I run an nginx Docker image or in fact I don't even need to ask the question I can actually truncate into that and he comes back with the command that we do each run even better than that because it's likely that we'll actually want to run it fairly soon after we can actually Supply and execute flag and it will come back and say do you want to run this okay let's run it and it's telling me I haven't got Docker running which is uh classic so let's open that okay let's try that again [Music] Electronics here yes unable to find it locally goes off and pulls it and cool we're running a Docker image so um if I do PS and see if it's running there we can see that it is running there and uh chat GPC is giving us the right command um we can actually abbreviate those two commands slightly e to Dash S and E it's a little bit easier so um so let's not run that again um so we can just literally run those two uh as Flags rather than a full argument um let's see if we can do something a little bit more complicated so this one I'm going to ask it to um show you the processors show all the processes that are running with that are an nginx image so it'll prompt us if we want to oh okay we've got quotes when you use notion and so it's saying um that's it's going to use this filter flag and it uses an ancestor nginx um that's not something that I'm going to remember and you might have to quickly remembering as well similarly with many other commands you may have you may forget them as well and so it's really handy to be able to query it like this so yeah there it comes back with the correct nginx image that's uh running at the minute and if we were running something else it would obviously filter it out of the way which is really handy another common one is something like fmpeg if you can't remember all the commands for that it's so really ridiculously powerful that there's so many different things you can do there what we can do though is we can actually initiate a session with it so we can do a chat session and that ends the argument to chat is f of MPEG um so I'm going to say converts a number of images to a movie which is something I commonly had to do when I was working in the film industry take a load of image shots images and frames and turn them into a movie and so here it's going again with the kind of directing into kind of chat uh interface with it we can guide it by adding those shell Flags again so now we've got what we've actually done is we've opened up a chat session we can carry on talking about that um chat session and guide it saying that we want a shell command okay and we also need to stay as an FFM Peg command to convert an image I like this little thing saying you're Consulting robots that's uh amusing so this has come back saying even though he specified as shell it has actually got some craft so I'd like tool it around the edge and the neat thing is because we've got it as a session we can go back and then say uh make the output a move and it's using the same session that we got there to correctly output the thing here is um that you can see it's actually taking the output the last response that it gave it's not no longer saying saying using this output as input here so if I say combine everything into a single command then it comes back with his full command which is something that you I couldn't possibly remember that and I would have to go off and look it up um admittedly it would be um something it probably store somewhere after you've done it once but yeah this you can see how this is going to be really useful for looking up stuff if you're just in the terminal um another thing we can do is actually there's a another flag which is code which allows us to basically just get it to um output scripts so output the code that we wanted so let's say um python code for mandal Rock [Music] okay there we go so we've got a whole this is literally come back mostly the code it does have some filler stuff at the top there which is not particularly handy but I mean this is gonna be great for just spitting it out to a piping that to a file and then using it so let's say something other than that like um okay so I've said use Python to scrape links from Hacker News homepage so you set that with code again with a code argument and it gives us some nice let's split that straight out into a scrape file um let's see actually the same thing that we had before which it is I'm not sure if it's caching this or if it's going off and so if I put the same thing in twice whether or not a cache slip it does have a kind of cut off on the memory so if you're going um cgbt here is options in order to be able to change the chat cache length so certain number of messages because obviously those messages are all sent over the wire every time that an API request is made um but yeah let's see if this actually works so if we install um [Music] I'm just going to run that from in the Rochelle [Music] okay that's good [Music] so weirdly that's seems to be looking at a particular class so I'm actually going to get rid of I'm gonna have to edit this let's just try that [Music] okay so we actually got something back at that time so not perfect so I've had to edit it but really handy to not have to go and think of all that stuff myself and find out the Minor Details of it um now I'm gonna know how to use um beautiful soup but if you if you don't use it regularly then it's a handy to be able to kind of make this to be able to just throw this out to chat GPT and get it to do it for you now I'm guessing that some of you uh will be asking but we're going to be able to do this with GitHub copilot X if it was announced earlier this week in fact actually let's put it up here so it's a suite of tools that was announced earlier this week by GitHub and they have got things for so it's an extension of GitHub Copilot they are going to be able to bring chat GPT into Visual Studio code and into the terminal and into pull requests three different places and be able to search documentation so lots of new things that it's all very exciting but none of it is available yet and you have to sit on a wait list for it also this copilot X and copilot itself are paid for products that are a monthly fee whereas the API is obviously you just pay for what you're using with chat GPT and we're talking pennies here if I go to my platform say if I go to my account and look at what I've used I can see that I've used 9p or nine cents rather um and that is uh yeah that's tiny uh depending on what you get paid as a developer so yeah I think this is really useful and the fact that we can just query any command get it in the bash straight away and get it in terminal and not have to move out of the terminal do you do things it's fantastic um hopefully you'll go and check it out um and see what you can do it as well um yeah so that's all for now um if you enjoyed the video give it a thumbs up uh consider subscribing to the channel and I'll speak to you soon in new video all right bye for now
Info
Channel: Ian Wootten
Views: 1,772
Rating: undefined out of 5
Keywords:
Id: agHO8xpCI0w
Channel Id: undefined
Length: 12min 33sec (753 seconds)
Published: Fri Mar 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.