Generate a Shell Command with No Explanation

Returns only a valid shell command for a given shell and operating system, in plain text, joining multiple steps with && and picking the most logical option when details are missing.

  • 🤖 Any chat LLM
  • 🗂️ Coding

Last verified: write-up checked

Prompt by Farkhod Sadykov (TheR1D/shell_gpt) · Original source (opens in a new tab)

Generate a Shell Command with No Explanation — prompt preview

The prompt

prompt
Provide only {shell} commands for {os} without any description.
If there is a lack of details, provide most logical solution.
Ensure the output is a valid shell command.
If multiple steps required try to combine them together using &&.
Provide only plain text without Markdown formatting.
Do not provide markdown formatting such as ```.

What it is

Returns only a valid shell command for a given shell and operating system, in plain text, joining multiple steps with && and picking the most logical option when details are missing. When ShellGPT saves this role it adds a first line, You are Shell Command Generator. The prompt text comes from the ShellGPT repository (MIT licence, Copyright (c) 2023 Farkhod Sadykov). Only the Python quotes around the string were removed. Placeholders keep the source syntax. Original author: Farkhod Sadykov (TheR1D/shell_gpt).

Who it's for

  • Developers
  • System administrators

يعيد أمر طرفية صالحًا فقط للصدفة ونظام التشغيل المحددين، بنص عادي، ويربط الخطوات المتعددة بـ && ويختار الحل الأنسب عند نقص التفاصيل.

Examples

Find files

shell
shell
sgpt --shell "find all json files in current folder"
# -> find . -type f -name "*.json"
# -> [E]xecute, [D]escribe, [A]bort: e

What it does: Command and output as printed in the ShellGPT README, not re-run by us.

The same request on Ubuntu

shell
shell
sgpt -s "update my system"
# -> sudo apt update && sudo apt upgrade -y
# -> [E]xecute, [D]escribe, [A]bort: e

What it does: The README says the same prompt on macOS gives a different command, because the role is filled with the system details. Not re-run by us.

Start a Docker container

shell
shell
sgpt -s "start nginx container, mount ./index.html"
# -> docker run -d -p 80:80 -v $(pwd)/index.html:/usr/share/nginx/html/index.html nginx
# -> [E]xecute, [D]escribe, [A]bort: e

What it does: Command and output as printed in the ShellGPT README, not re-run by us.

Tips

  • ShellGPT fills {shell} and {os} from your system, which the README shows giving different commands on macOS and Ubuntu.
  • The tool asks you to execute, describe or abort each generated command before anything runs.