AI pair programming in the terminal — for Linux SysAdmins
GitHub Copilot is an AI-powered coding assistant developed by GitHub and OpenAI. It was trained on billions of lines of public code and can suggest complete functions, scripts, and command sequences as you type. Think of it as autocomplete that actually understands what you're trying to accomplish.
For a Linux SysAdmin, Copilot is most immediately useful in two places: inside your editor when writing bash scripts, Python automation, or configuration files — and at the command line via GitHub Copilot in the CLI, which lets you ask natural-language questions and get shell commands back.
Copilot is a subscription service from GitHub (owned by Microsoft). As of early 2026:
The command-line interface component is what matters most for SysAdmins who live in the terminal. It requires the GitHub CLI (gh) as a base.
Step 1 — Install the GitHub CLI:
# RHEL/CentOS/Rocky (dnf) sudo dnf install gh # Debian/Ubuntu (apt) sudo apt install gh # Or install from GitHub releases if not in your distro repos: # https://github.com/cli/cli/releasesStep 2 — Authenticate with GitHub:
gh auth loginFollow the prompts — browser or token-based auth both work. Token auth is better for headless servers.
Step 3 — Install the Copilot CLI extension:
gh extension install github/gh-copilotStep 4 — Verify:
gh copilot --helpIf you use VS Code, Neovim, or JetBrains IDEs, Copilot plugins are available from their respective marketplaces. For pure terminal work, the CLI is sufficient.
gh may not be in the default repos. Add the GitHub CLI repo first:sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
Copilot CLI has two main subcommands: suggest and explain.
Describe what you want in plain English. Copilot returns a shell command.
gh copilot suggest "find all files larger than 500MB modified in the last 7 days"Copilot will ask whether you want a shell command, gh command, or git command, then return something like:
find / -type f -size +500M -mtime -7 2>/dev/nullYou can then copy it, run it, or ask Copilot to revise it.
Paste a command you found (or one Copilot gave you) and get a plain-English explanation:
gh copilot explain "awk -F: '$3 >= 1000 {print $1}' /etc/passwd"Copilot will walk through each part of the command. Useful for onboarding junior staff or verifying what a script is actually doing before you run it as root.
These get long fast. Add aliases to your .bashrc or .bash_profile:
Then just:
ghcs "show disk usage by directory under /var, sorted largest first"Beyond one-liners, Copilot shines when writing bash scripts in an editor. In VS Code with the Copilot plugin active, you write a comment describing what the function should do — Copilot suggests the implementation.
Example workflow in a script:
#!/bin/bash # Function: check if a port is open on a remote host, retry up to 5 times # with a 10-second delay between attempts, exit 0 on success, exit 1 on failure # -- Copilot will suggest the function body here as you pause --This works especially well for:
getoptscheck_ai_tree.sh does, but for Apache logs")When you use Copilot, your code and prompts are sent to GitHub's servers. For institutional use, this matters:
The honest assessment from someone who has been writing shell scripts since 1986:
Copilot CLI (gh copilot suggest) is genuinely useful for commands you don't run often enough to have memorized — obscure find predicates, rsync flag combinations, openssl one-liners. It's faster than a man page for "I know what I want, I just need the syntax."
For script generation, it's a competent first draft. Expect to edit it. The generated code tends to be correct in structure but generic — it won't know your shop's conventions, your logging format, or your error handling preferences. That's fine. A good first draft is still valuable.
The explain subcommand is underrated. Pasting a complex pipeline and getting a clear explanation is useful even for experienced admins — and invaluable for documentation and knowledge transfer.