Christian Heilmann

GitHub Copilot for the Command Line is amazing!

Wednesday, March 29th, 2023 at 4:32 pm

I just got access to GitHub Copilot CLI and a few seconds after installing it, I am happy as a clam about it.

GitHub Copilot logo on terminal

You can see it in action in this video or let me talk you through it here. GitHub Copilot CLI brings AI code completion to your terminal. After installing it, you get three new commands:

  • ??: Translate natural language to arbitrary shell commands
  • git?: Translate natural language to Git commands
  • gh?: Translate natural language to GitHub CLI commands

I love using the terminal, as it gives you a lot of power and it is a lot faster than other tools like Finder or Explorer. The issue is though that it is not easy to remember the sometimes cryptic syntax of bash commands and attributes of command line tools.

This is where Copilot CLI helps. Say you want to convert all the videos in the current folder to mp4 and resize them to 640 pixels width, keeping the aspect ratio. All you need to do is write `?? convert all videos in the folder to mp4 and resize them to 640px` hit enter. You get a suggestion of code that will do that task and a detailed, human readable explanation what the code does.

screeenshot of the terminal with the answer by copilot and a human readable explanation what the code does.

You can choose to run the command immediately, revise your input in case something feels off or cancel and go back to the terminal.

Another prompt I tried was `?? find all files bigger than 500mb and copy them to a folder called huge` and the result was immediate.

Finding big files in a folder and moving them to a dedicated folder as explained by CoPilot

I like that it doesn’t only give you the result, but also explains what the code does. This often is missing from answers on StackOverflow and other forums.

It will be interesting to see where this goes. The Terminal is a mighty tool and you can do a lot of damage if you are not aware of the consequences of your commands. It would be interesting to see Copilot also give you some safety instructions with every command it offers.

Share on Mastodon (needs instance)

Share on BlueSky

Newsletter

Check out the Dev Digest Newsletter I write every week for WeAreDevelopers. Latest issues:

Word is Doomed, Flawed LLM benchmarks, hard sorting and CSS mistakes Spot LLM benchmark flaws, learn why sorting is hard, how to run Doom in Word and how to say "no" like a manager.
30 years of JS, Browser AI, how attackers use GenAI, whistling code Learn how to use AI in your browser and not on the cloud, why AI makes different mistakes than humans and go and whistle up some code!
197: Dunning-Kruger steroids, state of cloud security, puppies>beer
196: AI killed devops, what now? LLM Political bias & AI security Learn how AI killed DevOps, create long tasks in JS, why 1 in 5 security breaches are AI generated code & play "The Scope Creep"
195: End of likes, JS Zoo and Tim Berners-Lee doesn't see AI vs Web Meta kills like buttons, Tim-Berners-Lee thinks AI won't kill the web, GitHub is ending toasts and the worst selling Microsoft product.

My other work: