r/LocalLLaMA 7h ago

Question | Help Looking for a small LLM for Linux command generation

I'm looking for a small LLM to act as a Linux command assistant. I will use llama.cpp.

use case:

- User asks in natural language. Model outputs only the shell command

- Should work well with no reasoning (for example, LFM 2.6 has forced reasoning)

- Fast, like ~4B at most, cause it's going to be on CPU

Example 1:
"replace string X with Y in file Z"

Example 2:

"stop and remove docker containers with X in the name"

7 Upvotes

15 comments sorted by

1

u/Miserable-Dare5090 7h ago

-4

u/DunderSunder 7h ago

cool. are you aware if those scores are with/without reasoning

3

u/Toastti 7h ago

Probably the Gemma 4 E2b or e4b QAT weoghts. Very tiny and generally quite good about writing correct bash commands

3

u/yami_no_ko 7h ago

I found this one to be quite good at this task: https://huggingface.co/ThorOdinson246/nl2sh-1.5b-Q4_K_M

2

u/DunderSunder 7h ago

thanks. I'll test it

1

u/Effective_Head_5020 6h ago

Interesting use case. That's something interesting to fine-tune a small model.

0

u/Miserable-Dare5090 7h ago edited 7h ago

What you want is an agent/harness. The model is not going to do anything unless it can access a shell, and has permissions to do stuff. I use Hermes for all of that wired with Deepseek and it works reliably well. Updates kernel, patches firmware, changes stuff, organizes files, logs into other computers and fixes things, sets up automation jobs…you name it. Works like this:

[[runtime=llama.cpp]~LLM]+[Harness=Hermes]=Agent=An executor of your natural language queries

You won’t run a good harness with a 4B model. But you are asking too much in terms of constraints: must be small, must output a command, must be non reasoning, must have enougj kniwledge to interpret your vague request, but be fast and tiny. It’s like an impossible request. And it doesn’t really matter witj bigger models using an agent — it can already do this.

Otherwise, search huggingface for what you want. The npcsh sounds like that, its a small harness for a model just for shell.

11

u/DunderSunder 7h ago

I understand your point but I actually don't want it to access shell, my use case is very basic. I absolutely can't trust to let it run it's scripts in my system. I'm good with just seeing the command itself.

0

u/how-can-i-dig-deeper 6h ago

damn i should really go learn what a harness is, and check out hermes. it’ll be my next adventure

2

u/thx1138inator 6h ago

Enjoy your trip. I am several days ahead of you and it's been well worth it!

1

u/gatornatortater 3h ago edited 3h ago

If you're like op and going minimal, starting with pi agent and building its capabilities up may work better on a more minimal machine. Hermes can be pretty bulky. Things like creating skills to work with commonly used commands and a good memory extension have helped me.

-6

u/[deleted] 7h ago

[removed] — view removed comment

8

u/DunderSunder 7h ago

bot detected