Large Language Models (LLMs) like GPT-4 are trained on vast datasets that include man pages, readmes, forum questions and discussions, source code and other sources of command line tool documentation. Given a set of requirements one can query a LLM to predict a command line that will perform the required task.

please-cli is a wrapper around GPT-4 that can help you translate your requirements into a shell command. Let’s start with an example:

benjamin@asterix:~# please convert a.jpeg to avif and upscale it to 200%
💡 Command:
convert a.jpeg -resize 200% a.avif

❗ What should I do? [use arrow keys or initials to navigate]
> [I] Invoke [C] Copy to clipboard [Q] Ask a question [A] Abort

Well, looks promising and the code actually works. please-cli also gives you some handy shortcuts to immediately invoke or copy the code. You can also inquire directly about the command.
In the following sections we will look at some other examples and wether we can find limitations of the script generation.

AI Assisted Shell Commands

Let’s see how well the please-cli generated command lines are for different use cases.

File Management

Handling files is a common shell task but one can easily forget certain switches or a more complex syntax. A simple example could be:

benjamin@asterix:docker-builder-container# please list the current directory contents sorted by size and display the size human readable
💡 Command:
ls -lhS

❗ What should I do? [use arrow keys or initials to navigate]
> [I] Invoke [C] Copy to clipboard [Q] Ask a question [A] Abort
Executing ...

total 24
-rw-r--r-- 1 benjamin staff 376B Oct 11 2022 Dockerfile
-rw-r--r-- 1 benjamin staff 43B Jun 20 2020
-rw-r--r-- 1 benjamin staff 43B Jun 26 2020 dockerbuilder.code-workspace

The command was correct and it also worked. I pressed the I key when prompted so please-cli invoked the generated command for me.
Now for something more complex: making directories accessible again. I tend to need this command sometimes but always forget the syntax with the curly brackets.

benjamin@asterix:~# please find all subfolders and add the execution flag for user and group
💡 Command:
find . -type d -exec chmod u+x,g+x {} \;

Ok, nice. please-cli even got the permissions right and didn’t add any other permissions than the ones requested.

Container Management

Next up: container management. Can it start a docker container?

benjamin@asterix:~# please start a docker mysql container with a loop mount to the data
💡 Command:
docker run -d -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag

Not with this query. The bind mount is ok but the detach flag is specified twice and the tag is wrong. But a slight improvement of the query fixes both problems:

benjamin@asterix:~# please start a docker mysql container with a loop mount to the data. the container is named mysql
💡 Command:
docker run --name mysql -v /my/own/datadir:/var/lib/mysql -d mysql:latest

There we go, now it works. This goes to show that the better your query is, the better the resulting command line.

Lastly, something that one will probably not use that often: flux reconciling from source on the demo namespace.

benjamin@asterix:~# please reconcile from source on the demo namespace
💡 Command:
echo 'I do not know. Please rephrase your question.'

That was not enough information. Let’s try with a bit more detail:

benjamin@asterix:~# please flux reconcile from git repo on the demo namespace
💡 Command:
flux reconcile source git demo --namespace=demo

Well, if your repo is named demo, then this command should work. Again, the more information you provide, the better the result.

Giving ffmpeg a Natural Language Interface With AI

FFmpeg is a very powerful media converter, streamer and recorder. But its command line can be daunting. The huge range of codecs, plugins, filters, etc…, each with their own switches is hard to remember. Let’s see how please-cli fares:

benjamin@asterix:~# please convert a.avi to h264 with preset slow and matroska container, copy the audio
💡 Command:
ffmpeg -i a.avi -c:v libx264 -preset slow -c:a copy output.mkv

The code works and all required settings are made. How about flags and some more exotic use cases:

benjamin@asterix:~# please convert the rtmp stream at to an hls stream with independent segments. the codec is h264 with preset ultrafast and a max rate of 3M and no audio
💡 Command:
ffmpeg -i rtmp:// -c:v libx264 -preset ultrafast -maxrate 3M -an -hls_flags independent_segments output.m3u8

Yes, works as well. Quite convenient, especially if you don’t need ffmpeg that often and always forget how to use it.


please-cli is a neat tool. It can save you loads of time reading through man pages or searching the web for the right syntax or switch to get your desired result. As always with current LLMs: the more specific you ask, the better the answer will be. Prompt engineering is not booming for no reason.