top of page

How to use Github Copilot in Command Line: It's amazing!

Updated: Jun 23, 2023

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

How to use Github Copilot in Command Line: It's amazing!

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.

How to use Github Copilot in Command Line: It's amazing!

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.

How to use Github Copilot in Command Line: It's amazing!

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.


Stationary photo

Be the first to know

Subscribe to our newsletter to receive news and updates.

Thanks for submitting!

Follow us
bottom of page