Ape is an AI for Linux commands.
ape "Find all the important PDF files in user/projects. An important PDF file has 'attention' in its name. Write the results to important_files.txt and then move it to Documents."Output:
find ~/user/projects -type f -name "*attention*.pdf" > important_files.txt && mv important_files.txt ~/Documents/
Currently, only OpenAI is supported.
To install (uv recommended):
uv tool install ape-linuxNext, set your OpenAI API key:
export APE_OPENAI_API_KEY=keyTo run:
ape "Create a symbolic link called win pointing to /mnt/c/Users/jdoe"Output:
ln -s /mnt/c/Users/jdoe win
Another example:
ape "Delete all the .venv directories under projects/"Output:
find projects/ -type d -name ".venv" -exec rm -rf {} +
If you try to ask something unrelated to Linux commands:
ape "Tell me about monkeys"you should get:
echo "Please try again."
You can change the model using --model or -m. The default is gpt-4o.
See here for a list of models. For example:
ape "List the contents of the working directory with as much detail as possible" --model gpt-3.5-turboOutput:
ls -lha
If you pass --execute or -e, the tool will run the command for you after printing it! Be careful with this as LLMs often make mistakes:
ape "Who am I logged in as?"Output:
whoami
jdoe
For more help:
ape --helpSee also: Gorilla