{"id":13408282,"url":"https://github.com/charyan/osh","last_synced_at":"2025-03-14T13:30:44.356Z","repository":{"id":217727941,"uuid":"744436658","full_name":"charyan/osh","owner":"charyan","description":"Ollama Shell Helper (osh) : English to Unix-like Shell Commands translation using Local LLMs with Ollama","archived":false,"fork":false,"pushed_at":"2024-01-19T07:07:52.000Z","size":93,"stargazers_count":39,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-06T00:10:05.924Z","etag":null,"topics":["llm","ollama","python","shell","unix"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-17T09:49:16.000Z","updated_at":"2025-02-21T07:45:42.000Z","dependencies_parsed_at":"2024-01-19T08:41:49.907Z","dependency_job_id":"b6a419c5-abd8-447e-82a9-3d869a9853da","html_url":"https://github.com/charyan/osh","commit_stats":null,"previous_names":["charyan/osh"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charyan%2Fosh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charyan%2Fosh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charyan%2Fosh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charyan%2Fosh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charyan","download_url":"https://codeload.github.com/charyan/osh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584075,"owners_count":20314694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["llm","ollama","python","shell","unix"],"created_at":"2024-07-30T20:00:51.864Z","updated_at":"2025-03-14T13:30:41.569Z","avatar_url":"https://github.com/charyan.png","language":"Python","funding_links":[],"categories":["Python","\u003ca name=\"ai-cli-commands\"\u003e\u003c/a\u003eAI terminal command generator"],"sub_categories":[],"readme":"# Ollama Shell Helper (osh) : English to Unix-like Shell Commands translation using Local LLMs with Ollama\n\n![screenshot](screenshot.png)\n\n# How it works\nThe user request is passed to the ollama server along with system information from `uname -a` and the distribution (if running on Linux). The result is displayed in the terminal and asks for confirmation to execute the command.\n\n```\nusage: osh.py [-h] [-y] [-s] [PROMPT]\n\nGet a command for a unix-like shell from a model running with Ollama and execute it\n\npositional arguments:\n  PROMPT\n\noptions:\n  -h, --help         show this help message and exit\n  -y, --yes          Execute the command without asking for confirmation\n  -s, --system-info  Display system info\n```\n\n# Usage\n## Ollama\nInstall [ollama](https://ollama.ai/)\n\nPull the model:\n```\nollama pull mistral\n```\n\nStart the ollama server:\n```\nollama serve\n```\n\n## OSH\n```\npython osh.py 'update all packages'\n\n```\n\n# Examples with Mistral 7B\n```\npython osh.py 'replace occurences of \"hello\" with \"h_ello\" in abc.txt'\n\nperl -pi -e 's/hello/h\\_ello/g' abc.txt\n```\n\n```\npython osh.py 'change owner of abc.txt to root'\n\nchown root abc.txt\n```\n\n```\npython osh.py 'enable docker at startup'\n\nsudo systemctl enable docker.service\nsudo systemctl start docker.service\n```\n\n```\npython osh.py 'docker run an ubuntu with terminal attached and port 8080 of the host mapped to 80 of the container'\n\nsudo docker run --rm -it -p 8080:80 ubuntu:latest /bin/bash\n```\n\n\n```\npython osh.py 'add the user johnny with the groups docker, wheel and dev'\n\nsudo useradd -m -g wheel -G docker,dev johnny\n```\n\n```\npython osh.py 'download https://something.com/file.html and transform it into a pdf with pandoc'\n\nwget -P ~/Downloads \"https://something.com/file.html\" \u0026\u0026 \\\npandoc -f html -t pdf ~/Downloads/file.html -o ~/Documents/output.pdf\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharyan%2Fosh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharyan%2Fosh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharyan%2Fosh/lists"}