This project provides a command-line tool to answer Linux command-line and scripting-related queries. Bash is the default language if not requested otherwise. It uses OpenAI's GPT model to generate concise, code-focused responses.
- Natural Usage: Invoke the tool as if starting a sentence with "how to...".
- OpenAI API Integration: Leverages GPT for intelligent responses.
- Simulated Typing: Outputs results character by character for an engaging experience.
- JSON Parsing: Extracts and formats relevant code or answers.
- Python 3.6 or later
- An OpenAI API key
- Python sdk package
openapi
Export your OpenAI API key as an environment variable:
export OPENAI_API_KEY="your_openai_api_key"Move the how script to a directory in your PATH, such as ~/.local/bin, for easy access:
mv how ~/.local/bin/Alternatively, you can add the directory containing how to your PATH environment variable. For example, if the script is in ~/scripts, add the following line to your ~/.bashrc or ~/.zshrc:
export PATH="$PATH:~/scripts"Then reload your shell configuration:
source ~/.bashrcInvoke the tool directly writing the query:
how <your-query>$ how to list all running processes
ps aux
$ how to find the 5 biggest directories in my home
du -ah ~ | sort -rh | head -n 5- Typing Speed: Adjust the
simulated_typingfunction inhow_to.pyto change the typing effect speed. - API Response Creativity: Modify the
temperatureparameter in the Python script for more deterministic or creative responses.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it.